Sorted exsl:node-set. Return node by it position.
Posted
by kalininew
on Stack Overflow
See other posts from Stack Overflow
or by kalininew
Published on 2010-03-18T15:13:54Z
Indexed on
2010/03/18
16:51 UTC
Read the original article
Hit count: 476
Good afternoon, gentlemen. Help me solve a very simple task.
I have a set of nodes
<menuList>
<mode name="aasdf"/>
<mode name="vfssdd"/>
<mode name="aswer"/>
<mode name="ddffe"/>
<mode name="ffrthjhj"/>
<mode name="dfdf"/>
<mode name="vbdg"/>
<mode name="wewer"/>
<mode name="mkiiu"/>
<mode name="yhtyh"/>
and so on...
</menuList>
I have it sorted now this way
<xsl:variable name="rtf">
<xsl:for-each select="//menuList/mode">
<xsl:sort data-type="text" order="ascending" select="@name"/>
<xsl:value-of select="@name"/>
</xsl:for-each>
</xsl:variable>
Now I need to get an arbitrary element in the sorted array to the number of its position. I write code
<xsl:value-of select="exsl:node-set($rtf)[position() = 3]"/>
and get a response error. How to do it right?
© Stack Overflow or respective owner