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

Re: Sorting different date formats

Subject: Re: Sorting different date formats
From: Mukul Gandhi <mukulgandhi2003@xxxxxxxxxxx>
Date: Tue, 13 Jan 2004 16:26:59 +0000 (GMT)
different date format
Hi Allan,
  I have come up with a sorting algorithm. Hope its
correct, and suits your requirement ;)

<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:msxsl="urn:schemas-microsoft-com:xslt"
exclude-result-prefixes="msxsl">
<xsl:output method="xml" version="1.0"
encoding="UTF-8" indent="yes"/>
	
<xsl:template match="/dates">
  <xsl:variable name="RTF">
    <xsl:for-each select="endDate">
      <endDate>
	<xsl:value-of select="translate(.,'-','')"/>
      </endDate>
    </xsl:for-each>
  </xsl:variable>
		
  <xsl:for-each select="msxsl:node-set($RTF)/endDate">
     <xsl:sort select="." data-type="number"/>
     <endDate>
	<xsl:value-of select="substring(. , 1, 4 )"
/>-<xsl:value-of select="substring(. , 5, 2 )"
/>-<xsl:value-of select="substring(. , 7, 2 )" />-
     </endDate>
   </xsl:for-each>
</xsl:template>
	
</xsl:stylesheet>

Regards,
Mukul

 --- allan.mccluskey@xxxxxxxxxxxxxxxxx wrote: > Hi
all,
> 
> Could someone please show me how to perform and
> XSL:SORT on an date in this
> format? <endDate>2004-02-15</endDate>
> 
> I have many other sorts that I need to perform so an
> explantion would also
> be much appreciated so I can fully understand how
> you do it : )
> 
> Many thanks,
> Allan
> 
> 
> 
> 
> 
> 
> Important:  This e-mail is intended for the use of
> the addressee and may contain information that is
> confidential, commercially valuable or subject to
> legal or parliamentary privilege.  If you are not
> the intended recipient you are notified that any
> review, re-transmission, disclosure, use or
> dissemination of this communication is strictly
> prohibited by several Commonwealth Acts of
> Parliament.  If you have received this communication
> in error please notify the sender immediately and
> delete all copies of this transmission together with
> any attachments.
> 
> 
>  XSL-List info and archive: 
> http://www.mulberrytech.com/xsl/xsl-list
>  

________________________________________________________________________
Yahoo! India Mobile: Download the latest polyphonic ringtones.
Go to http://in.mobile.yahoo.com

 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.