XSLT 2.0 node variable select by attribute



In my XSLT 2.0 file I want to acess the NewID of following variable if the currentID is equal to the OldID.



<xsl:variable name="Items">
<Item OldID="test1" NewID = "TEST01"></Item>
<Item OldID="test2" NewID = "TEST02"></Item>
</xsl:variable>


Following code:



<xsl:template match="xmlitem">
<xsl:value-of select="$Items/Item/@OldID = @currentID" />
</xsl:template>


returns true but:



<xsl:value-of select="$Items/Item[@OldID = @currentID]/@NewID"/>


is not working. I'm not sure if this is working like this? Or do I have to loop with a for-each?


No comments:

Post a Comment