[xsl] method to parse date time stamp

Subject: [xsl] method to parse date time stamp
From: "Walter Torres" <walter@xxxxxxxxx>
Date: Wed, 31 Jan 2001 13:23:36 -0600
the date time is created using this format...

<timeStamp>2001-01-31T01:21:35Z</timeStamp>

This is a standard format, I just don't recall the RFC number on it.

After reading the archives of this list and Mr Kays book, I came up with
this solution (see below).

Is there a "better" way to do this?

Looking forward to your opinions...

Thanks

Walter

=================================================
<!-- timestamp NODE Template -->
<xsl:template match='pubdate'>
 <td>
  <!-- make this value a variable -->
  <xsl:variable name='datetime' select='.' />
  <!-- Pull the pieces apart -->
  <xsl:variable name='year'  select='substring( $datetime, 0 , 5 )' />
  <xsl:variable name='month' select='substring( $datetime, 6 , 2 )' />
  <xsl:variable name='day'   select='substring( $datetime, 9 , 2 )' />
  <!-- put the date together in American order -->
  <xsl:value-of select="concat($month, '/', $day, '/', $year )"/>
  <!-- Seperate the date and Time -->
  -
  <!-- Display the Time -->
  <xsl:value-of select='substring( $datetime, 12 , 8 )'/>
 </td>
</xsl:template>

=================================================



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


Current Thread