我有以下代码:
<xsl:variable name="helper"
select="func:getSer(service)"/>
<xsl:for-each select="$helper">
<xsl:variable name="itName" select="func:cppNamespacePath(.)"/>
<xsl:text>
</xsl:text>
</xsl:for-each>
<xsl:value-of select="$itName"/>
但它给出了错误,即未定义的变量“ itName”
我必须从for循环中获取最后一个输出。并在for循环外使用它。请告诉我解决方案
提前致谢。
最佳答案
假设getSer()
返回一个节点集,您可以将其最后一个元素传递给cppNamespacePath()
,如下所示:
<xsl:variable name="helper"
select="func:cppNamespacePath( func:getSer(service)[last()] )"/>
关于linux - 如何选择最后一个节点,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/5312233/