Re: [xsl] Sorting times in xslt

Subject: Re: [xsl] Sorting times in xslt
From: "Alan Jones" <ajones@xxxxxxxxxxxxxx>
Date: Tue, 02 Jan 2001 11:26:21 -0500
Mathew,

Possibly a clue...check the spec, but this may be of use:

<xsl:eval>

   attribute_value=parseInt(this.text); <!--change the text to number if
desired-->
   formatNumber(input / 2.2046, "0.0"); <!--perform an operation on the
number and format the resulting string output-->

</xsl:eval>

the formatNumber is the opposite of what you want but i included it
anyway.






Matthew Cordes wrote:

> Hello all,
>
> I'm curious what possible solutions you folks might have for sorting
> times in XSLT.
>
> e.g.
>
> I have the following xml:
>
> <times>
>         <time value="10:45"/>
>         <time value="1:15"/>
>         <time value="9:43"/>
>         <time value="35:27"/>
>         <time value="20:48"/>
> </times>
>
> and I wish to sort it by the value attribute, thus generating the
> following:
>
> <times>
>         <time value="1:15"/>
>         <time value="9:43"/>
>         <time value="10:45"/>
>         <time value="20:48"/>
>         <time value="35:27"/>
> </times>
>
> The problem is that due to the colons the value is evaluated as a
> string, not a number and thus produces:
>
> <times>
>         <time value="1:15"/>
>         <time value="10:45"/>
>         <time value="9:43"/>
>         <time value="20:48"/>
>         <time value="35:27"/>
> </times>
>
> Note the 10:45 is out of place.  Any ideas?
>
> -matt
>
>  XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list

--

Alan R. Jones
Advanced Visualization & Integration group
Autometric, a Business Unit of The Boeing Company
7700 Boston Blvd., Springfield, Va. 22153
http://www.autometric.com
ajones@xxxxxxxxxxxxxx  703.923.5389



 XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list


Current Thread