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 — DomDocument オブジェクトに XSLT 変換を適用する
説明
DomDocument DomXsltStylesheet::process
( DomDocument
$xml_doc
[, array $xslt_params
[, bool $is_xpath_param
[, string $profile_filename
]]] )与えられた DomDocument オブジェクトに XSLT 変換を適用します。
パラメータ
-
xml_doc -
DomDocument オブジェクトとしての変換される XML 文章
-
xslt_params -
パラメータ名と値のペアを持つ連想配列
-
is_xpath_param -
FALSEに設定された場合、xslt_paramsの値は句オーとされます。これはデフォルトの動作です。 PHP 文字列として値を渡すことができます。注意:
もし文字列がシングルクォートとダブルクォートの両方を含んでいる場合、 このパラメータを
TRUEに設定し、 ご自身で全ての値のクォーティングを行う必要があります。 -
profile_filename -
プロファイリング情報を希望する場合、ファイル名のパスを設定します。
返り値
処理結果を DomDocument オブジェクトとして返します。
PHP 5 への移行
XSLTProcessor::setParameter() と XSLTProcessor::transform-to-doc() を使用してください。
変更履歴
| バージョン | 説明 |
|---|---|
| 4.3.0 |
profile_filename パラメータが追加されました。
|
参考
- domxml_xslt_stylesheet() - 文字列での XSL 文章から DomXsltStylesheet オブジェクトを作成する
- domxml_xslt_stylesheet_file() - ファイル中の XSL 文章から DomXsltStylesheet オブジェクトを作成する
- domxml_xslt_stylesheet_doc() - DomDocument オブジェクトから DomXsltStylesheet オブジェクトを作成する
msh at 247ms dot com
29-Oct-2006 11:36
Thomas Broyer
23-Aug-2005 12: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.
regis at nvision dot lu
10-Jun-2004 02: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
