[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

RE: order-by vs xsl:sort

Subject: RE: order-by vs xsl:sort
From: "Michael Kay" <mike@xxxxxxxxxxxx>
Date: Fri, 29 Apr 2005 14:00:28 +0100
RE:  order-by vs xsl:sort
> Not really. It models it as a sequence of integers of length M*N and
> calculates the sort key (and data needed for the result) by 
> calculating
> the equivalent indexes into the original sequences using mod and idiv.
> 
> given the general 2 variable case:
> 
> 
> for $i in $is,  $j in $js
> order by f($i,$j)
> return
> g($i,$j)
> 
> for some functions f and g then I think you can always replace this by
> 
> let $ci :=count($is) return
> let $cj :=count($js) return
> for $n in (0 to $ci * $cj)
> let $i :=$is[$n  mod $ci)+1]
> let $j := $js[($n idiv $ci) +1]
> order by f($i, $j)
> return
> g($i,$j)
> 
> and once you have just a single for and order by, converting 
> that to xsl
> for-each and sort is just syntax.
> 

Nice result. Perhaps I can get rid of those horrible tuples in my
implementation!

Michael Kay
http://www.saxonica.com/

Current Thread

PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.