Subject: Re: sort by date
From: "James Fuller" <james.fuller@xxxxxxxxxx>
Date: Tue, 26 Nov 2002 12:43:31 -0500 (EST)
|
might also have some luck using www.exslt.org date/time templates
gl, jim fuller
> At 10:16 AM 11/26/2002, you wrote:
>> <a4013 date="1998-01-03T00:00:00">FRUTAS</a4013>
>>
>>the "T00:00:00" has no use but some one can point an
>>idea to get the desired sort by date?
>
> The quickest to write and easiest to use IMO would be to use
>substring-before() and substring-after() to pick apart the date into
>pieces you want. For example,
> <xsl:template name="my-date">
> <xsl:param name="date" value="''"/>
> <xsl:if test="$date">
> <xsl:variable name="year" select="substring-before($date, '-')" />
> <xsl:variable name="month" select="substring-before(
> substring-after($date,
> '-'),
> '-')" />
> <xsl:variable name="day" select="substring-before(
> substring-after(
> substring-after($date,
> '-'),
> '-'),
> 'T')" />
> <!-- Display date components however you'd like -->
> <!-- This one produces MM/DD/YY -->
> <xsl:value-of select="$month" />
> <xsl:text>/</xsl:text>
> <xsl:value-of select="$day" />
> <xsl:text>/</xsl:text>
> <xsl:value-of select="substring($year, 2)" />
> <xsl:if>
> </xsl:template>
>
> and call it with something like
>
> <xsl:call-template name="my-date">
> <xsl:with-param name="date" select="/a4013-list/a4013[1]/@date" />
> </xsl:call-template>
>
> I'm sure that there are other examples out there for transforming 12
>
> into 'December' and other niceties.
>
>
> Greg Faron
> Integre Technical Publishing Co.
>
>
>
> XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
|