Altova Mailing List Archives


RE: [xsl] order-by vs xsl:sort

From: "Michael Kay" <mike@------------>
To:
Date: 4/29/2005 1:01:00 PM
> 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/

Disclaimer

These Archives are provided for informational purposes only and have been generated directly from the Altova mailing list archive system and are comprised of the lists set forth on www.altova.com/list/index.html. Therefore, Altova does not warrant or guarantee the accuracy, reliability, completeness, usefulness, non-infringement of intellectual property rights, or quality of any content on the Altova Mailing List Archive(s), regardless of who originates that content. You expressly understand and agree that you bear all risks associated with using or relying on that content. Altova will not be liable or responsible in any way for any content posted including, but not limited to, any errors or omissions in content, or for any losses or damage of any kind incurred as a result of the use of or reliance on any content. This disclaimer and limitation on liability is in addition to the disclaimers and limitations contained in the Website Terms of Use and elsewhere on the site.