Hello, I am a newbee myself, but perhaps something like this?
If you have a variable called DaysOfWeek containing the following nodeset:
<Week>
<Day>MON</Day>
<Day>TUE</Day>
<Day>WEN</Day>
<Day>THU</Day>
<Day>FRI</Day>
<!-- perhaps also one for SAT and SUN -->
</Week>
If it is possible to sort like the following....?
<xsl:sort select="pos($DaysOfWeek/Day[.=substring(dayCode,3)]"
type="number"/>
<xsl:sort select="substring(daycode,4,1)" type="number"/>
I am not very good at xpath, so the syntax in the predicative is probably
wrond, and I do not know if this kind of sort is even possible - what is
meant is that the sort - instead of sorting over dayCode - should sort over
the dayCode's position in the variable (the position of the Day element that
have the same value as the dayCode).
So this is as much a question from me as a try for a solution.
Regards, and merry christmas,
Ragulf Pickaxe :)
From: allan(_dot_)mccluskey(_at_)centrelink(_dot_)gov(_dot_)au
Reply-To: xsl-list(_at_)lists(_dot_)mulberrytech(_dot_)com
To: XSL-List(_at_)lists(_dot_)mulberrytech(_dot_)com
Subject: [xsl] Sorting by days of the week
Date: Tue, 23 Dec 2003 13:49:24 +1100
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 values: 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
_________________________________________________________________
Add photos to your e-mail with MSN 8. Get 2 months FREE*.
http://join.msn.com/?page=features/featuredemail
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list