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

Re: xsl sorting on derived values

Subject: Re: xsl sorting on derived values
From: Trevor Nash <tcn@xxxxxxxxxxxxx>
Date: Wed, 18 Sep 2002 15:48:37 +0100
michael croft
On Mon, 16 Sep 2002 15:08:30 +0100, you wrote:

>Hi,
>
>I need to sort a list based on a value derived from a doubly recursive loop.
>It is a table for cumulative time and I current generate the times using a
>template to perform the recursive steps but I need to sort on these for
>display. Does anyone know if this is possible and, if so, how it can be
>done.
>
Hi Mike

Without knowing exactly what your algorithm is, its hard to tell...
but in principle you can sort on anything that you can calculate in an
XPath expression.  There are tricks you can use to get the effect of
conditionals, but recursion is probably out of the question.

There are a number of approaches:
1.  Can you use sum() instead of recursion?
2.  Do the processing in two passes (either separate transforms or
using node-set), so the first calculates the value you want to sort on
(see the identity transform).
3. Use an extension, assuming you do not mind being tied to one
processor (for example, saxon:function does a good job)
4. Use XSLT 2.0 / XPath 2.0 (currently that means Saxon 7.2).  XPath
2.0 has more facilities which might be enough to implement your time
calculation purely in XPath.

HTH

Trevor Nash
--
Traditional training & distance learning,
Consultancy by email

Melvaig Software Engineering Limited
voice:     +44 (0) 1445 771 271 
email:     tcn@xxxxxxxxxxxxx

 XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list


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.