Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Xpath : Sort

Status
Not open for further replies.

VJay

Programmer
Mar 26, 2002
19
IN
Is is possible to sort the contents of a XML document using Xpath? Could not locate any function.
Otherwise is there any provision to use the sort of xsl in SelectNodes function of DOM?


 
by way of example:


<xsl:for-each select=&quot;iftislog/entry&quot; order-by=&quot;time&quot;>


-pete
 
using xpath, not that I know of...

You could write a small stylesheet, transform the xml into its sorted order, and then select the nodes in this order.

<xsl:apply-templates select=&quot;//nodes&quot;>
<xsl:sort select=&quot;wibble&quot; order=&quot;ascending&quot;/>
</xsl:apply-templates>


or

<xsl:for-each select=&quot;womble&quot;>
<xsl:sort select=&quot;@hatsize&quot; order=&quot;descending&quot;/>
...
</xsl:for-each>
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top