XPath 1.0 doesn't have sorting ability AFAIK. Though you can use XPath 1.0
to implement sorting outside of the XPath language.

e.g. in dom4j you can sort the results of an XPath expression using another
XPath expression.

import org.dom4j.*;

Document doc = ...;
XPath query = doc.createXPath( "//Customer" );
XPath sortBy = doc.createXPath( "NAME" );

List sortedCustomers
    = query.selectNodes( doc, sortBy, true );

The optional last boolean argument allows duplicates to be removed.

James
----- Original Message -----
From: "George Pieri" <[EMAIL PROTECTED]>
To: "Jaxen-Interest" <[EMAIL PROTECTED]>
Sent: Monday, April 15, 2002 7:07 PM
Subject: [Jaxen] Sorting XML with XPath expressions !?!


>
>
> I know with XSL I can sort data by placing <xsl:sort> between
> <xsl:apply-template> or <xsl:for-each> tags.
>
> Using JAXEN and Xpath expressions, given that I have an XML string
> can I sort it by one of the columns (e.g. NAME)
>
> String xmlQuery="/Customers/NAME/asc()";   // sort ascending
>
> or
>
> String xmlQuery="/Customers/NAME/desc()";
>
>
> where xmlQuery is the XPath expression !?!
>
>
> Thanks in advance!
>
> _______________________________________________
> Jaxen-interest mailing list
> [EMAIL PROTECTED]
> https://lists.sourceforge.net/lists/listinfo/jaxen-interest


_________________________________________________________
Do You Yahoo!?
Get your free @yahoo.com address at http://mail.yahoo.com


_______________________________________________
Jaxen-interest mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/jaxen-interest

Reply via email to