This is the mail archive of the xsl-list@mulberrytech.com mailing list .


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

method to parse date time stamp


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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]