[Home] [By Thread] [By Date] [Recent Entries]

Subject: RE: Formatting date
From: Jarno.Elovirta@xxxxxxxxx
Date: Fri, 8 Nov 2002 16:28:57 +0200
Hi,

> I want to format the next element:
> 
>   <creation_date>2/9/2001 9:23:13</creation_date>
> 
> And transform to:
> 
>   <cr_date day="02" month="09" year="2001"/>
> 
> Can I do this transformation using XSL.

  <xsl:template match="creation_date">
    <cr_date day="{format-number(substring-before(., '/'), '00')}"
             month="{format-number(substring-before(substring-after(., '/'), '/'), '00')}"
             year="{substring-before(substring-after(substring-after(., '/'), '/'), ' ')}"/>
  </xsl:template>

Cheers,

Jarno

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


Current Thread
  • Formatting date
    • Felix Garcia - Fri, 8 Nov 2002 08:52:44 -0500 (EST)
      • <Possible follow-ups>
      • Jarno . Elovirta - Fri, 8 Nov 2002 09:24:49 -0500 (EST) <=
      • Ben Robb - Fri, 8 Nov 2002 09:37:50 -0500 (EST)
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member