[XSL-LIST Mailing List Archive Home] [By Thread] [By Date]

RE: [xsl] Formatting date


Subject: RE: [xsl] 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