This is the mail archive of the
xsl-list@mulberrytech.com
mailing list .
Re: Sorting times in xslt
- To: xsl-list at lists dot mulberrytech dot com
- Subject: Re: [xsl] Sorting times in xslt
- From: "Alan Jones" <ajones at autometric dot com>
- Date: Tue, 02 Jan 2001 11:26:21 -0500
- References: <20010102104758.A12170@plan9ws1.uct.usm.maine.edu>
- Reply-To: xsl-list at lists dot mulberrytech dot com
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@autometric.com 703.923.5389
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list