[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

Re: Sorting times in xslt

Subject: Re: Sorting times in xslt
From: "Alan Jones" <ajones@xxxxxxxxxxxxxx>
Date: Tue, 02 Jan 2001 11:26:21 -0500
text to number output
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

PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.