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

RE: XSL - using for-each with sort - can't access pre

Subject: RE: XSL - using for-each with sort - can't access previoussorted nod e
From: David Carlisle <davidc@xxxxxxxxx>
Date: Tue, 25 Nov 2003 23:26:12 GMT
sort in xsl
actually it's surprisingly dificult in pure xslt 1 to sort and process
(or query) at the same time.

Almost all processors provide a node-set() extension function which
makes things much easier.

First sort:

<xsl:variable name="x">
<xsl:for-each select="question">
<xsl:sort...
<xsl:copy-of select="."/>
</xsl:for-each>
<xsl:variable>

Now $x is essentially your sorted list and in xslt2 (or xslt 1.1 draft)
you'd be able to apply templates to that, but in xslt1.0  it's a result tree
fragment that can be copied to the output but not queried.

But assuming you have x:node-set() in your processors extension
namespace
you can do
<xsl:apply-templates select="x:node-set($x)/question"/>

and then the previous question is just preceding-sibling::question[1] as
usual as your (new) input is sorted.

David

-- 
http://www.dcarlisle.demon.co.uk/matthew

 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.