Modules | Supported Version: 2
This implementation relies on Source<xsl:param name="date:date-time" select="'2000-01-01T00:00:00Z'" /> <xsl:template name="date:year"> <xsl:param name="date-time"> <xsl:choose> <xsl:when test="function-available('date:date-time')"> <xsl:value-of select="date:date-time()" /> </xsl:when> <xsl:otherwise> <xsl:value-of select="$date:date-time" /> </xsl:otherwise> </xsl:choose> </xsl:param> <xsl:variable name="neg" select="starts-with($date-time, '-')" /> <xsl:variable name="dt-no-neg"> <xsl:choose> <xsl:when test="$neg or starts-with($date-time, '+')"> <xsl:value-of select="substring($date-time, 2)" /> </xsl:when> <xsl:otherwise> <xsl:value-of select="$date-time" /> </xsl:otherwise> </xsl:choose> </xsl:variable> <xsl:variable name="dt-no-neg-length" select="string-length($dt-no-neg)" /> <xsl:variable name="timezone"> <xsl:choose> <xsl:when test="substring($dt-no-neg, $dt-no-neg-length) = 'Z'">Z</xsl:when> <xsl:otherwise> <xsl:variable name="tz" select="substring($dt-no-neg, $dt-no-neg-length - 5)" /> <xsl:if test="(substring($tz, 1, 1) = '-' or substring($tz, 1, 1) = '+') and substring($tz, 4, 1) = ':'"> <xsl:value-of select="$tz" /> </xsl:if> </xsl:otherwise> </xsl:choose> </xsl:variable> <xsl:variable name="year"> <xsl:if test="not(string($timezone)) or $timezone = 'Z' or (substring($timezone, 2, 2) Change HistoryPrevious Version: date.year.1.html
|
http://www.exslt.org/date/functions/year/date.year.template.xsl.html last modified 2002-11-12