Posted By

sukantahazra on 12/08/10


Tagged

time date format xslt


Versions (?)

XSLT date time processing


 / Published in: XSLT
 

  1. <xsl:template name="formatDate">
  2. <xsl:param name="dateTime" />
  3. <xsl:variable name="date" select="substring-before($dateTime, 'T')" />
  4. <xsl:variable name="year" select="substring-before($date, '-')" />
  5. <xsl:variable name="month" select="substring-before(substring-after($date, '-'), '-')" />
  6. <xsl:variable name="day" select="substring-after(substring-after($date, '-'), '-')" />
  7. <xsl:value-of select="concat($day, ' ', $month, ' ', $year)" />
  8. </xsl:template>
  9.  
  10. <xsl:template name="formatTime">
  11. <xsl:param name="dateTime" />
  12. <xsl:value-of select="substring-after($dateTime, 'T')" />
  13. </xsl:template>
  14.  
  15.  
  16. <xsl:call-template name="formatDate">
  17. <xsl:with-param name="dateTime" select="xpath" />
  18. </xsl:call-template>
  19.  
  20. <xsl:call-template name="formatTime">
  21. <xsl:with-param name="dateTime" select="xpath" />
  22. </xsl:call-template>

Report this snippet  

You need to login to post a comment.