Seems that the transformer is not handling "namespace-alias" correctly. I have been trying to generate XSL with my XML/XSL using this nice feature as described here:
http://www.topxml.com/xsl/examplegenss.asp
http://www.w3schools.com/xsl/el_namespace-alias.asp
Not sure if this is "correct" or "wrong" depending on how you look at it - but just make a note of it so you dont spend an entire Sunday trying to figure out what you did wrong since the basic examples aren't working :-)
DomXsltStylesheet->process
(PHP 4 >= 4.1.0)
DomXsltStylesheet->process — Aplica la transformación XSLT sobre un objeto DomDocument
Descripción
Aplica una Transformación XSLT sobre el objeto DomDocument dado.
Parámetros
- xml_doc
-
El documento XML a ser transformado, como un objeto DomDocument.
- xslt_params
-
Un array asociativo que toma parejas de nombres de parámetro y valores.
- is_xpath_param
-
Si su valor es FALSE los valores de xslt_params serán rodeados de comillas. Este es el comportamiento predeterminado. Le permite pasar valores como cadenas PHP.
Note:
Si sus cadenas contienen tanto comillas sencillas como dobles, debe cuidarse de rodear de comillas todos los valores usted mismo y definir este parámetro como TRUE.
- profile_filename
-
Defina este parámetro con la ruta de un nombre de archivo, si desea información de parametrización.
Valores devueltos
Devuelve el resultado del procesamiento, como un objeto DomDocument.
Migración a PHP 5
Use XSLTProcessor::setParameter() y XSLTProcessor::transform-to-doc().
Historial de cambios
| Versión | Descripción |
|---|---|
| 4.3.0 | Fue agregado el parámetro profile_filename. |
Ver también
- domxml_xslt_stylesheet() - Crea un objeto DomXsltStylesheet desde un documento XSL en una cadena
- domxml_xslt_stylesheet_file() - Crea un objeto DomXsltStylesheet desde un documento XSL en un fichero
- domxml_xslt_stylesheet_doc() - Crea un objeto DomXsltStylesheet desde un objeto DomDocument
Within LibXML/LibXSLT, the values of the parameters passed in to the XSLT stylesheet for processing are treated as being XPath expressions to be applied to the source document. This allows you to pass parameters of type "node-set".
This is actually the same as if you modified your XSLT stylesheet to change the default value of the top-level xsl:param to <xsl:param name="param-name" select="param-value" />
As this behavior might be a bit misleading, the PHP/DOMXML binding defaults to "converting" every parameter value to a string, as if you modified your XSLT stylesheet to change the default value of the top-level xsl:param to <xsl:param name="param-name" select="'param-value'" /> (note the single-quotes around the value and enclosed in double-quotes).
If you want to turn back to the original LibXML/LibXSLT behavior, just pass TRUE as the "is_param_xpath" argument.
Needless to say that xslt_parameters is an associative array. So for instance:
<?php
$document = new DOMDocument('/path/to/xmldata');
// Unfortunately there's no such method for DomXsltStylesheet
$stylesheet = domxml_xslt_stylesheet_file('/path/to/stylesheet');
$params = array(
'param1' => 'value1'
...
, 'paramN' => 'valueN' );
$result = $stylesheet->process($document, $params);
?>
As far as the param_is_xpath argument is concerned, XPath W3REC doesn't mention any parameter at any time ! That must be a DOM feature, which I'm not keen with yet...
Bye
