[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] Re: Sort
Hi Jon, > I have a sorting question for the group. I have elements like the following: > > <Marquee Class="RIO_container" Expiration_day="Indefinite" > Expiration_month="Indefinite" Expiration_year="Indefinite" > Id="vt_182-Virtual_teams-Marquee.xml" Last_modifier="admin" > Maximum_number="" Modification_date="Thursday, July 20, 2000 10:38:21 AM > PDT" Owner="admin" Progress="complete" Status="modify" Used_in=" vt"> > > I want to sort by the Modification_date attribute. How can I do this > efficiently with XSLT? Or maybe I just can't? I've tried using a JavaScript > extension to manipulate the numbers but it just didn't seem to work. I'd > prefer not to do it with Java but with if I have to. Use multiple <xsl:sort> statements: <xsl:sort select="substring( substring-after( substring-after(@Modification_date,','), ','), 2, 4)" /> <!-- this should select 2000, not tested ... --> <!-- sort by month, see below --> <xsl:sort select="substring ..." /> <!-- select day etc. --> One problem is the month given with its name. A solution is in the XSL FAQ - look for "arbitrary sorting": http://www.dpawson.freeserve.co.uk/xsl/N6461.html#N13098 and http://www.dpawson.freeserve.co.uk/xsl/N6461.html#N13111 Cheers, Oliver /-------------------------------------------------------------------\ | ob|do Dipl.Inf. Oliver Becker | | --+-- E-Mail: obecker@xxxxxxxxxxxxxxxxxxxxxxx | | op|qo WWW: http://www.informatik.hu-berlin.de/~obecker | \-------------------------------------------------------------------/ XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
|
PURCHASE STYLUS STUDIO ONLINE TODAY!Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced! Download The World's Best XML IDE!Accelerate XML development with our award-winning XML IDE - Download a free trial today! Subscribe in XML format
|