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

Sorting date format

Subject: Sorting date format
From: "V.Ramkumar" <v.ramkumar@xxxxxxxxxxxxxxxxxxxxxx>
Date: Tue, 23 Dec 2008 15:23:22 +0530
 Sorting date format
Hi List,

How to sort the date field. Please see below and provide solution.

XML:
<?xml version="1.0" encoding="UTF-8"?>
<root>
    <date>07/12/07</date>
    <date>11/12/06</date>
    <date>10/12/05</date>
    <date>21/02/05</date>
</root>

XSL:
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
version="2.0">
<xsl:output omit-xml-declaration="yes"/>

    <xsl:template match="/">
    <xsl:apply-templates/>
</xsl:template>

    <xsl:template match="root">
        <xsl:for-each select="date">
            <xsl:sort select="." order="ascending" data-type="text"
/><xsl:copy-of select="."/>
        </xsl:for-each>
    </xsl:template>
    
</xsl:stylesheet>

Required Output:

    <date>21/02/05</date>
    <date>10/12/05</date>
    <date>11/12/06</date>
    <date>07/12/07</date>

Regards,
Ramkumar

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.