Altova Mailing List Archives>Archive Index >comp.text.xml Archive Home >Recent entries >Thread Prev - How to sort values via XPath >Thread Next - Re: How to sort values via XPath Re: How to sort values via XPathTo: NULL Date: 8/24/2009 12:22:00 PM Norbert Pürringer wrote: > does anyone know how to get a sorted list of XML nodes via XPath? I > know the function distinct-values but I there seems to be no function > like sorted-values. Pure XPath alone (at least in versions 1.0 and 2.0) does not provide any features to sort. However languages like XQuery or XSLT which make use of XPath provide features to sort, XQuery with the order by clause in FLWOR expressions (http://www.w3.org/TR/xquery/#id-orderby-return) and XSLT with the xsl:sort element (http://www.w3.org/TR/xslt20/#xsl-sort) and XSLT 2.0 additionally with xsl:perform-sort (http://www.w3.org/TR/xslt20/#creating-sorted-sequence). Depending on the XPath API you use there might also be sorting features exposed for instance in .NET's XPath's API you can use http://msdn.microsoft.com/en-us/library/system.xml.xpath.xpathexpression.addsort.aspx -- Martin Honnen http://msmvps.com/blogs/martin_honnen/ | ||||||
| Company | Legal | Press | Partners | Careers | Sitemap | Contact Us | Altova Blog | Mobile | Full Site | |||
|
