我有这个...
<xsl:stylesheet version="1.1" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:exslt="http://exslt.org/common">
<xsl:variable name="data">
<root>
<test>1000</test>
<test>2000</test>
<test>3000</test>
</root>
</xsl:variable>
<xsl:template match="/">
<xsl:for-each select="$data/root/test">
<xsl:for-each select="."/>
</xsl:for-each>
</xsl:template>
</xsl:stylesheet>
而且我认为对于 XSLT 1.1,$data 变量将被视为节点集,因此标准的 XSLT 东西——比如 for-each——应该可以工作。
我没有收到错误,但没有输出 - 好像 $data 节点集完全为空。
我也试过这个
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:exslt="http://exslt.org/common">
<xsl:variable name="data">
<root>
<test>1000</test>
<test>2000</test>
<test>3000</test>
</root>
</xsl:variable>
<xsl:template match="/">
<xsl:for-each select="exslt:node-set($data)/root/test">
<xsl:for-each select="."/>
</xsl:for-each>
</xsl:template>
</xsl:stylesheet>
结果相同。(事实上,我以前做过这个没有问题)我正在使用撒克逊人。
我错过了什么?(顺便说一句,我无法使用 XSLT 2.0)
谢谢