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

Re: Sorting by days of the week

Subject: Re: Sorting by days of the week
From: "Vasu Chakkera" <vasucv@xxxxxxxxxxx>
Date: Sat, 27 Dec 2003 17:22:26 -0800
vasu chakkera
Hi Allan
Using xsl:sort you can sort the nodes  basdd on attribute values or node
values.
xsl sort has the two attributes order=""  and data-type="" ...
order takes ascending or descending and data-type takes text or number
since you are sorting it with your daycode, which happens to be a text, it
is getting sorted in ascending order of the String
so Fair enough to expect it in the order you got it.

If you want to get an ordered days of week, you must have a weekdayid of
some sort as an attribute.
example
<days>
<day weekdayid = "1" dayCode = "MON"/>
<day weekdayid = "2" dayCode = "TUE"/>
<day weekdayid = "3" dayCode = "WED"/>
<day weekdayid = "4" dayCode = "THUR"/>
<day weekdayid = "5" dayCode = "FRI"/>
<day weekdayid = "6" dayCode = "SAT"/>
<day weekdayid = "7" dayCode = "SUN"/>
</days>
you can now sort on the weekdayid ascending or descending and print the
dayCode.
That should help you sor your nodes
Thanks
Vasu
----- Original Message ----- 
From: <allan.mccluskey@xxxxxxxxxxxxxxxxx>
To: <XSL-List@xxxxxxxxxxxxxxxxxxxxxx>
Sent: Monday, December 22, 2003 6:49 PM
Subject:  Sorting by days of the week


> G'day all,
>
> I need to sort my output by days of the week. i.e. I have a element called
> 'dayCode' which can contain one of the following valus: MON1, MON2, TUE1,
> TUE2, WED1, WED2, THU1, THU2, FRI1, FRI2 etc etc
>
> I've tried using <xsl:sort select="dayCode" order="ascending"/> but as you
> would expect, the output order is FRI, MON, THU, TUE, WED.
>
> Is there a way to do this kind or sort??
>
> Cheers
> Allan
>
>
>
>
> Important:  This e-mail is intended for the use of the addressee and may
contain information that is confidential, commercially valuable or subject
to legal or parliamentary privilege.  If you are not the intended recipient
you are notified that any review, re-transmission, disclosure, use or
dissemination of this communication is strictly prohibited by several
Commonwealth Acts of Parliament.  If you have received this communication in
error please notify the sender immediately and delete all copies of this
transmission together with any attachments.
>
>
>  XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
>
>

 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.