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 — Applique une transformation XSLT à un objet domdocument
Description
Applique une Transformation XSLT sur l'objet DomDocument donné.
Liste de paramètres
- xml_doc
-
Le document XML qui sera transformé, comme un objet DomDocument.
- xslt_params
-
Un tableau associatif composé de paires de paramètres noms et valeurs.
- is_xpath_param
-
Si FALSE, les valeurs de xslt_params seront mises entre guillemets. Ceci est le comportement par défaut. Cela vous permet de passer les valeurs comme des chaînes de caractères PHP.
Note: Si vos chaînes de caractères contiennent des apostrophes et des guillemets, vous devez faire attention à mettre en guillemets toutes les valeurs par vous-même et mettre ce paramètre à TRUE.
- profile_filename
-
Mettre ce paramètre à un chemin d'un fichier, si vous souhaitez avoir des informations de profilage.
Valeurs de retour
Retourne le résultat du traitement, comme un objet DomDocument.
Migration vers PHP 5
Utilisez XSLTProcessor::setParameter() et XSLTProcessor::transform-to-doc().
Historique
| Version | Description |
|---|---|
| 4.3.0 | Le paramètre profile_filename a été ajouté. |
Voir aussi
- domxml_xslt_stylesheet() - Crée un objet DomXsltStylesheet à partir d'un document XSL dans une chaîne
- domxml_xslt_stylesheet_file() - Crée un objet DomXsltStylesheet à partir d'un document XSL dans un fichier
- domxml_xslt_stylesheet_doc() - Crée un objet DomXsltStylesheet à partir d'un objet DomDocument
DomXsltStylesheet->process
29-Oct-2006 08:36
23-Aug-2005 09:54
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.
10-Jun-2004 11:48
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
