If I had a lookup table in XML like this:
<lookup>
<element key='abc'>Hello</element>
</lookup>
And another XML file like this:
<root>
<child key='abc'>Goodbye</child>
</root>
And I do this XSL transformation after loading the first file into a variable:
<xsl:variable name="myvar" select="document('lookupfile.xml')/lookup" />
<xsl:value-of select="$myvar/element[@key=/root/child/@key]" />
What I want is the value 'Hello' to come up, but instead I get nothing. Am I not allowed to compare the value of two nodes directly? Every example I see always compares [@key='hardCodedValue'] and never to the value of another node.
If I hardcode the value like so: select="$myvar/element[@key='abc'] it returns 'Hello'. If I directly output the value of the root/child key with select="/root/child/@key" I get the correct value 'abc'. It's just when I try to do the comparison above that it returns nothing.
$myvar?