[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: David Carlisle <davidc@xxxxxxxxx>
Date: Fri, 29 Apr 2005 15:40:37 +0100
xsl sort twice
> 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

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.