Re: [xsl] sorting by date

Subject: Re: [xsl] sorting by date
From: Steve.Ball@xxxxxxxxx
Date: Tue, 23 Oct 2001 14:27:45 +1000
Katie McNally wrote:
> 
> The format of the dates returned in my XML is 17-Dec-2000 07:23:32.  I need
> to display dates as 12/17/00.  I am formatting the dates I display by
> calling the following template:
[...snip...]

The XSLT Standard Library, http://xsltsl.sf.net/, has a date-time
module which includes a template for formatting dates.

> I am displaying the dates in a table.  The table can be sorted by the user
> by clicking on the column titles.  I am able to sort the table for all of
> the non-date columns, but do not know how to sort the table by date.

What it does *not* include is a way of parsing dates.  You have to do
that yourself :-(

Get your dates into ISO format: YYYYMMDDHHMMSS.  For example,
20011023141400
(2:14PM, 23rd October 2001).  The date value can then be treated as an
integer
for sorting purposes.  Use the date module in XSLTSL to get it back into
a human-readable form.

Cheers,
Steve Ball

-- 
Steve Ball            |   XSLT Standard Library   | Training & Seminars
Zveno Pty Ltd         |     Web Tcl Complete      |   XML XSL Schemas
http://www.zveno.com/ |      TclXML TclDOM        | Tcl, Web Development
Steve.Ball@xxxxxxxxx  +---------------------------+---------------------
Ph. +61 2 6242 4099   |   Mobile (0413) 594 462   | Fax +61 2 6242 4099

 XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list


Current Thread