xsl-list
[Top] [All Lists]

Re: [xsl] Sorting by date

2008-05-27 08:59:17
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

--~------------------------------------------------------------------
XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: <mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--

<Prev in Thread] Current Thread [Next in Thread>