Reputation: 1769
lets say I have this XML :
<myxml>
<Labels>
<Label>
<id>id1</id>
<value>abc</value>
</Label>
<Label>
<id>id2</id>
<value>def</value>
</Label>
<Label>
<id>id3</id>
<value>ghi</value>
</Label>
<Label>
<id>id4</id>
<value>jkl</value>
</Label>
<Label>
<id>id5</id>
<value>mno</value>
</Label>
</Labels>
</myxml>
And I would like to display the value "def" and "jkl".
I'm looking for the XPath expression that allow me to take the value of a label where the id is "id2".
I've tried with this :
<xsl:value-of disable-output-escaping="yes" select="Labels/Label[id = 'id2']/value"/>
but it's not working ... Is there a way to do that ?
Thanks in advance for your answer, Best regards
Upvotes: 0
Views: 103
Reputation: 11771
Have you tried adding the root to your xpath?
<xsl:value-of select="myxml/Labels/Label[id = 'id2']/value" />
Also, disable-output-escaping
is typically unnecessary.
Upvotes: 1