xsl-list
[Top] [All Lists]

RE: order-by vs xsl:sort

2005-04-29 06:00:28
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/



--~------------------------------------------------------------------
XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: <mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--



<Prev in Thread] Current Thread [Next in Thread>