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

Re: sort on more than one element

Subject: Re: sort on more than one element
From: Jeni Tennison <mail@xxxxxxxxxxxxxxxx>
Date: Wed, 1 Nov 2000 10:02:00 -0400 (EST)
many xsl sort
Raj,

>iam using xsl:sort and i need to sort of more than one element
>
>ex
>
><xsl:sort select="col1;col2"/>
>
>the parser says that it does not expect a ';'. I tried a ',' - but dint
work too.
>
>what is the right way to do this.

The right way is to use two xsl:sort elements to specify the two levels of
the sort:

  <xsl:sort select="col1" />
  <xsl:sort select="col2" />

The advantage of this syntax over a comma-separated list is that you can
have different properties attached to the two sorts, such as the order in
which the list is sorted by these cols, or whether the cols are treated as
text or numbers:

  <xsl:sort select="col1" order="ascending" data-type="text" />
  <xsl:sort select="col2" order="descending" data-type="number" />

You can add as many xsl:sorts as you want within an xsl:for-each or an
xsl:apply-templates.

I hope that this helps,

Jeni

Jeni Tennison
http://www.jenitennison.com/




 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.