[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

RE: Sort by date

Subject: RE: Sort by date
From: Jarno.Elovirta@xxxxxxxxx
Date: Wed, 16 Apr 2003 12:20:35 +0300
xsl sort by months names
> I need to sort records in my XSL stylesheet descending by 
> date (i.e. newest
> date first).
> 
> The problem is that the dates are in a text field in 
> localized form, i.e.
> 
> <date>24. April 2003</date>
> 
> I have no clue how to approach this or if it will be possible at all.

<xsl:sort data-type="number" select="concat(substring-after(substring-after(., ' '), ' '), format-number(document('')/*/x:months/month[@name = substring-before(substring-after(current(), ' '), ' ')]/@number, '00'), format-number(substring-before(., '.'), '00'))" />

with

<x:months>
  <month name="January" number="1" />
  <month name="February" number="2" />
  <month name="March" number="3" />
  <month name="April" number="4" />
  <month name="May" number="5" />
  <month name="June" number="6" />
  <month name="July" number="7" />
  <month name="August" number="8" />
  <month name="September" number="9" />
  <month name="October" number="10" />
  <month name="November" number="11" />
  <month name="December" number="12" />
</x:months>

as a top-level element in your stylesheet.

Cheers,

Jarno - Velvet Acid Christ: Psycho

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


Current Thread

PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.