xsl-list
[Top] [All Lists]

RE: Formatting date

2002-11-08 07:28:57
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



<Prev in Thread] Current Thread [Next in Thread>