|
top
|
Subject: EXSLT extensions in Stylusstudio Author: (Deleted User) Date: 12 Dec 2007 03:13 AM
|
Hi Mike,
you can use a template like this:
<xsl:template name="parse-date">
<xsl:param name="date"/>
<xsl:variable name="month" select="substring-before($date, '/')"/>
<xsl:variable name="rest1" select="substring-after($date, '/')"/>
<xsl:variable name="day" select="substring-before($rest1, '/')"/>
<xsl:variable name="rest2" select="substring-after($rest1, '/')"/>
<xsl:variable name="year" select="substring-before($rest2, ' ')"/>
<xsl:variable name="rest3" select="substring-after($rest2, ' ')"/>
<xsl:variable name="hour" select="substring-before($rest3, ':')"/>
<xsl:variable name="rest4" select="substring-after($rest3, ':')"/>
<xsl:variable name="minute" select="substring-before($rest4, ':')"/>
<xsl:variable name="second" select="substring-after($rest4, ':')"/>
<xsl:value-of select="concat($year, '-', $month, '-', $day, 'T', $hour, ':', $minute, ':', $second)"/>
</xsl:template>
(you may want to add some code for error checking and day/month/hour/minute padding)
You can invoke it using
<xsl:call-template name="parse-date">
<xsl:with-param name="date" select="'12/12/2007 15:34:23'"/>
</xsl:call-template>
Hope this helps,
Alberto
|
|
|
|