I have nested xsl:for loops:
<xsl:for-each select="/Root/A">
<xsl:for-each select="/Root/B">
<!-- Code -->
</xsl:for>
</xsl:for>
From within the inner loop, how can I access attributes from the current node in the outer loop?
I keep finding myself writing code like this:
<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>
This doesn't scale very well, as sometimes I need to access several pieces of information and end up creating one variable for each piece. Is there an easier way?
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…