I have some XML like this:
<MT N="tag1" V="text"/>
<MT N="tag2" V="more text"/>
<MT N="tag3" V="other text"/>
<MT N="tag4" V="something cool"/>
<MT N="target_tag" V="i want this"/>
<MT N="target_tag" V="and this"/>
I'm trying to target the MT
where N=target_tag
and by number (1 or 2).
The following doesn't work, despite what I was hoping from this link:
<xsl:variable name="display" select="MT[@N = 'target_tag' and 2]/@V" />
If I try this, I consistently get the first one:
<xsl:variable name="display" select="MT[@N = 'target_tag']/@V" />
And if I try this, I consistently get the second MT tag (so "more text" in this example):
<xsl:variable name="display" select="MT[2]/@V" />
I've tried this with no luck too:
<xsl:variable name="display" select="MT[2][@N = 'target_tag']/@V" />
Based on my requirements, I need to combine them, so that when I'm looping through a recursive function I can show the first, then the second, then the third.
Any ideas how these can be combined?
select="MT[@N = 'target_tag'][2]"
should work.