Re: [xsl] Date Formating

Subject: Re: [xsl] Date Formating
From: Heiko Specht <heiko@xxxxxxxxxx>
Date: Sun, 12 Jan 2003 15:28:29 +0100
Hello Arthur,

you may try this



<date-created>2003-01-12</date-created>

<xsl:template name="dateFormat">
  <xsl:param name="str" select="/date-created" />
  <xsl:param name="year" select="substring-before($str, '-')" />
  <xsl:param name="end" select="substring-after($str, '-')" />
  <xsl:param name="day" select="substring-after($end, '-')" />
  <xsl:param name="month" select="substring-before($end, '-')" />
  <xsl:choose>
    <xsl:when test="$month = '01'">
      <xsl:variable name="mon">Jan</xsl:variable>
    </xsl:when>
    .... <!-- make this for each month -->
    <xsl:otherwise />
  </xsl:choose>
  <xsl:value-of select="$day" />-<xsl:value-of select="$mon" />-<xsl:value-of select="$year" />
</xsl:template>

in your xsl you have to call this template
 with: <xsl:call-template name="dateFormat" /> at the point you need
 it.

best regards

Heiko

Friday, December 12, 2003, 2:09:43 PM, you wrote:

A> Hello xsl-list,

A>   I'm transforming an xml file that gives me a nicely formatted report
A>   (html 80 odd pages).
A>   Part of the transform uses format-number() for decimal places etc.

A>   one of the elements in the xml, is a date
A>   <date-created>2003-01-12</date-created>

A>   How do you transform this to 12-Jan-03 ?


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


Current Thread