【发布时间】:2010-06-22 18:17:51
【问题描述】:
我有这个……
<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)
谢谢
【问题讨论】: