PHP 5.5.9、XSLT 1.0将节点传递到模板


PHP 5.5.9 , XSLT 1.0 pass nodes to template

我尝试从传递给模板的参数中通过节点名称获取节点值。

<?xml version="1.0" encoding="utf-8"?>
<root>
<test>
<test1>test1_descr</test1>
<test2>test2_descr</test2>
<test3>test3_descr</test3>
</test>
</root>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:template match="report">
<xsl:apply-templates select="list">
                <xsl:with-param name="node" select="/root/test"/>
            </xsl:apply-templates>
 </xsl:template>
 <xsl:template match="list">
    <xsl:param name="node"/>
     <xsl:value-of select="$node/*[local-name() = 'test1']"/> -- error_string
     <xsl:value-of select="$node"/> -- result_string
 <xsl:apply-templates select="item">
 ....
</xsl:template>

当我调用'error_string'时,我看到错误:XSLTProcessor::transformToXml(): Invalid type。当我调用'result_string'时,我在输出中看到:

test1_descr
test2_descr
test3_descr

怎么了?

问题解决。这是我代码中的错误。模板' list '从几个部分调用,其中一个部分缺少' xsl:with-param '元素。谢谢关注!