I'm sure I don't need to use a variable here, but can't work out the XPath. How do you select an attribute of the context node when you have to navigate up and down the tree?
XML:
XSL:
Thanks,
Jon
XML:
Code:
<?xml version="1.0" encoding="UTF-8"?>
<test>
<row id="1">
<item1>an item</item1>
<item2>another item</item2>
</row>
<row id="2">
<item1>an item</item1>
<item2>another item</item2>
</row>
<x>
<y id="2">
<amount>100</amount>
</y>
</x>
</test>
XSL:
Code:
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="1.0" xmlns:xsl="[URL unfurl="true"]http://www.w3.org/1999/XSL/Transform">[/URL]
<xsl:template match="/">
<xsl:for-each select="test/row">
<xsl:variable name="id" select="@id" />
<xsl:value-of select="../x/y[@id= $id]/amount"/>
</xsl:for-each>
</xsl:template>
</xsl:stylesheet>
Thanks,
Jon