我嵌套了xsl:for循环:
<xsl:for-each select="/Root/A">
<xsl:for-each select="/Root/B">
<!-- Code -->
</xsl:for>
</xsl:for>
Run Code Online (Sandbox Code Playgroud)
在内部循环中,如何从外部循环中的当前节点访问属性?
我一直在发现自己写这样的代码:
<xsl:for-each select="/Root/A">
<xsl:variable name="someattribute" select="@SomeAttribute"/>
<xsl:for-each select="/Root/B">
<!-- Now can use $someattribute to access data from 'A' -->
</xsl:for>
</xsl:for>
Run Code Online (Sandbox Code Playgroud)
这不能很好地扩展,因为有时我需要访问几条信息并最终为每个部分创建一个变量.有没有更简单的方法?