What is the nature of your application? Is it XQuery, XSLT, XPath-embedded-in-Java, or what?
 
If you are trying to program directly to Saxon's Java API, and to do a sort at that level, the approach I would recommend is to create a FixedSortKeyDefinition defining the sort key as an XPath expression, and then to construct a SortedIterator using that sort key definition to produce the sorted results. However, it's probably easier to write the whole thing as a query using "for $e in elements order by string($e) return $e" and then use the XQuery API to get the results.
 
Michael Kay


From: saxon-help-admin@lists.sourceforge.net [mailto:saxon-help-admin@lists.sourceforge.net] On Behalf Of Kofman, Irena
Sent: 13 September 2004 07:09
To: saxon-help@lists.sourceforge.net
Subject: RE: [saxon] Sorting question

Hello!

Thank you for answer. I probably misunderstood the purpose of this class. In this particular case I need to sort large xml structure. I’ll probably need to sort it by the text values of elements. The structure has depth of 1 under the root, so no inner tree sorting is needed. Is TupleSortert the class that I need for this mission?

            Thank you

                        Irena Kofman

 


From: saxon-help-admin@lists.sourceforge.net [mailto:saxon-help-admin@lists.sourceforge.net] On Behalf Of Michael Kay
Sent: Sunday, September 12, 2004 8:38 PM
To: saxon-help@lists.sourceforge.net
Subject: RE: [saxon] Sorting question

 

I can't really explain how to use this class without some idea of what you are trying to achieve. It's an internal class that's used as part of the expression tree generated when an xsl:sort element in XSLT is compiled. It's not used directly to support sorting in XQuery (the "order by" clause of a FLWOR expression) - the XQuery implementation uses the class TupleSorter instead.

 

Please let me know what you are trying to accomplish.

 

Michael Kay

 


From: saxon-help-admin@lists.sourceforge.net [mailto:saxon-help-admin@lists.sourceforge.net] On Behalf Of Kofman, Irena
Sent: 12 September 2004 15:08
To: saxon-help@lists.sourceforge.net
Subject: [saxon] Sorting question

From what I understood, in saxon, there is SortExpression class, that should replace sorting in form of : let $a := something return $a sorteby something else.

 

I just don’t understand, how to use this class?

Can you help me?

            Thank you

                        Irena Kofman