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

Subject: Re: [xsl] order-by vs xsl:sort
From: David Carlisle <davidc@xxxxxxxxx>
Date: Fri, 29 Apr 2005 15:40:37 +0100
> Nice result.

horrible syntax though:-) How are you supposed to remember where to use ","
where to use ";" and where to let the parser figure out where the
expression ends?

Here's a version that's accepted by saxon's xquery parser and gives the
same result as before

let
 $is := $data1/z/y ,
 $js := $data2/z/y ,
 $ci := count($is), 
 $cj := count($js)
for $n in (0 to ($ci * $cj -1))
let $i := $is[($n  mod $ci)+1],
    $j := $js[($n idiv $ci) +1]
order by ($j/@id - $i/@id)
return
concat($i/../@id,$j/../@id)

The xslt expression is exactly the same except (as I commented in the
original note) you can't sneak the variable binding in before
the xsl:sort in the xsl version so the index expressions appear twice.
They could be made into function calls though I suppose which would look
nicer even if they still get evaluated twice.

David

________________________________________________________________________
This e-mail has been scanned for all viruses by Star. The
service is powered by MessageLabs. For more information on a proactive
anti-virus service working around the clock, around the globe, visit:
http://www.star.net.uk
________________________________________________________________________

Current Thread