我的理解是,它<xsl:variable>
是不可变的,不能重新分配。
我是 XSL 的新手,遇到了类似于下面示例中的情况。
<xsl:stylesheet>
<xsl:variable name="temp" select="true()"/>
<xsl:template name="example">
<xsl:variable name="temp" select="false()"/>
<p><xsl:value-of select="$temp"/></p>
</xsl:template>
</styleheet>
关于为什么会发生这种情况,我还没有找到任何明确的结论。我可以推断我没有收到错误以及为什么temp
会输出的唯一方法false
是存在一个全局temp
变量和一个局部temp
变量(并且不知何故没有冲突)。
为什么我能够“重新分配” temp
?