Re: [xsl] Sorting by date

Subject: Re: [xsl] Sorting by date
From: Michael Ludwig <mlu@xxxxxxxxxxxxx>
Date: Tue, 27 May 2008 17:58:43 +0200
sudheshna iyer schrieb:
      <SortDate>Wed, 18 Feb 2008 11:18:41
-0000</SortDate>

I need to sort by date(SortDate)

Fix your data to include a nicely sortable date representation like the ISO datetime, or a UNIX timestamp, or even the W3C datetime.

and prepare a html file which outputs the following:

SortDate (yyyy-mm-dd format)
title: modelDate

Eg Output:
2008-02-19 ==> notice that Feb 19 item is displayed
1st
item 2

In XSLT 1.0, which doesn't have a comprehensive date library and which you're maybe restricted to, I'd invoke the transformation from Perl or Java or whatever, and use the host language library to do the date formatting work via strftime and company. This is not a pure XSLT solution and may be called cheating, but it works.

In XSLT 2.0, which I don't know much about, there are a lot of functions
for date, time and even duration manipulation, but I wonder if there is
anything as cool as strftime?

    FunctX XQuery Functions: Dates, Times and Durations
    http://www.xqueryfunctions.com/xq/c0002.html

Michael

Current Thread