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

Re: Re-ordering elements

Subject: Re: Re-ordering elements
From: David Carlisle <davidc@xxxxxxxxx>
Date: Thu, 20 Jan 2000 19:58:39 GMT
xsl sort by two elements
Could I do this for the non-continquous example:

    <xsl:for-each select="mantra" >
                <xsl:sort select="[@id='rv1.84.10a']" />
                <xsl:sort select="[@id='rv3.62.10c']" />
                <xsl:sort select="[@id='rv1.164.1a']" />
                <xsl:sort select="[@id='rv1.164.1e']" />
                <xsl:sort select="[@id='rv1.14.1a']" />


the way sort works is this.

You have two nodes, you want to decide if one is greater than the other
so you evaluate the expression specified in xsl:sort on each
node, and compare those values. If they are equal, and a second xsl:sort
is specified then use that expression, and so on until you get two
different values, once you get different values sort those two nodes
so the computed values are in the right order, and then start comparing
two more nodes....

But look at your sort expression,  select="[@id='rv1.84.10a']"
for _every_ node you evaluate that on, you will _always_ get the SAME
answer, namely the string value of the node with id rv1.84.10a.
So your entire sort is a complete no op. Every comparison will
compare two equal strings.

> In other words, is "sort" the only way? 
No the simpler and more direct way is just to step through the two sets
of verses taking one mantra at a time, that was my first posting, but
you didn't like it. (No one ever likes my postings, I fear)


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

Current Thread


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.
First Name
Last Name
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.