groads2 Posted April 22, 2013 Share Posted April 22, 2013 I have an xml that will have 10 instances of a tag. I want to put each instance in a certain place on my html form. How do I select the specific occurance of an xml tag? Link to comment Share on other sites More sharing options...
Martin Honnen Posted April 23, 2013 Share Posted April 23, 2013 Use a positional predicate foo[x] (the first index is 1) e.g. <xsl:template match="/"> <xsl:value-of select="root/foo[3]"/></xsl:template> outputs the string value of the third 'foo' child element of the 'root' element.If you are not looking for a certain child element but for the third 'foo' element in the complete document (where 'foo' elements could exist at different nesting levels) then use <xsl:template match="/"> <xsl:value-of select="(//foo)[3]"/></xsl:template> Link to comment Share on other sites More sharing options...
groads2 Posted April 25, 2013 Author Share Posted April 25, 2013 Thanks Martin. That was what I was looking for. Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now