This is the mail archive of the
xsl-list@mulberrytech.com
mailing list .
Re: sorting numbers
- From: Jeni Tennison <jeni at jenitennison dot com>
- To: Frederic Leclercq <frederic at ictportal dot com>
- Cc: xsl-list at lists dot mulberrytech dot com
- Date: Fri, 15 Feb 2002 09:37:53 +0000
- Subject: Re: [xsl] sorting numbers
- Organization: Jeni Tennison Consulting Ltd
- References: <20020216092610.1c5a04a5.frederic@ictportal.com>
- Reply-to: xsl-list at lists dot mulberrytech dot com
Hi Frederic,
> In my xml string i get numbers, now if i do a usual sort i'll get
> something like 0- 1 - 2 - 21 - 29 - 3
>
> etc... nog i'd like to get that sorted as 0 - 1 - 3 - 21 - 29 ...
By default with xsl:sort you get alphabetical sort; you want a
numerical sort. You can make the XSLT processor sort numerically by
setting the data-type attribute on xsl:sort to "number" rather than
the default "text". For example:
<xsl:sort data-type="number" />
Cheers,
Jeni
---
Jeni Tennison
http://www.jenitennison.com/
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list