tags:

views:

25

answers:

1

In the following XML, I would like only get the number 2 and 5 items, how could it be done on XSLT?

<root>
    <content>item 1</content>
    <content>item 2</content>
    <content>item 3</content>
    <content>item 4</content>
    <content>item 5</content>
    <content>item 6</content>
</root>
+1  A: 

Try this:

<xsl:value-of select="/root/content[2]" /> 
<xsl:value-of select="/root/content[5]" /> 

NOTE:

Oded is right but I think this is the best you can get

Abe Miessler
Almost right. Array indexes start with 1 in XSLT.
Oded
Doh! Thanks for the reminder.
Abe Miessler