all groups > dotnet xml > september 2003 >
You're in the

dotnet xml

group:

Sort by date [XSLT]


Sort by date [XSLT] Ron Vecchi
9/25/2003 12:46:21 PM
dotnet xml:
Is there a way to use <xsl:sort> to sort by date.

Sample xml doc I want to perform sorting on
---------------------------------------------
<Parent>
<child>
<date>10/10/2003</date>
<displayText>The text that should be displayed</displayText>
</child>
<child>
<date>9/10/2001</date>
<displayText>The text that should be displayed</displayText>
</child>
<child>
<date>1/10/2002</date>
<displayText>The text that should be displayed</displayText>
</child>
</Parent>


Thanks,

Ron Vecchi

Re: Sort by date [XSLT] Ron Vecchi
9/25/2003 2:17:44 PM
Thanks got it to work,


[quoted text, click to view]

Re: Sort by date [XSLT] Dimitre Novatchev
9/25/2003 7:44:31 PM

[quoted text, click to view]

Because the date format in your example is quite irregular, I'd recommend
processing in two passes:

1. Create a copy of the source.xml in which all dates have the same
format, e.g. yyyymmdd

2. Sort on the date element.


=====
Cheers,

Dimitre Novatchev.
http://fxsl.sourceforge.net/ -- the home of FXSL



[quoted text, click to view]

AddThis Social Bookmark Button