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

RE: Problem with Variables

Subject: RE: Problem with Variables
From: "Andrew Welch" <AWelch@xxxxxxxxxxxxxxx>
Date: Mon, 2 Feb 2004 15:51:04 -0000
xsl pad
> I am writing a stylesheet which makes a conversion of a date. 
> ie: 1.3.2003 should become 2003.03.01

You can do this in one line:

<xsl:value-of select="
    concat(
    substring-after(substring-after($date,'.'),'.')
    ,'.',
    format-number(substring-before(substring-after($date,'.'),'.'),'00')
    ,'.',
    format-number(substring-before($date,'.'),'00')
    )"/>

The only bit I think you wont already know here is format-number(),
which in this case allows you to pad with zeros to get at least 2 digits

cheers
andrew 

 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.