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

Re: Natural Sort

Subject: Re: Natural Sort
From: David Carlisle <davidc@xxxxxxxxx>
Date: Wed, 25 Jan 2006 10:11:24 GMT
server dn
> I don't think I can use a regular expression as the second parameter
> for substring-*

You could in XSLT2, in XSLT1 you could do:

<xsl:sort
  select="translate(substring-before(@dn, '.'),'0123456789','')"
  data-type="text"
  order="ascending"/>
<xsl:sort
  select="translate(substring-before(@dn, '.'),'abcdefghijklmnopqrstuvwxyz','')"
  data-type="number"
  order="ascending"/>


so this sorts first on the text then on the numbers, so all teh media
ones would come before the members oones, but mefia10 will come after
media2.


>> <server dn="media1.mysite.com" id="server392" os="FreeBSD 5.1"/>
>> <server dn="media2.mysite.com" id="Server488" os="Fedora Core 1"/>
>>    ...
>> <server dn="media10.mysite.com" id="Server433" os="Fedora Core 1"/>

>> <server dn="members1.mysite.com" id="server322" os="Debian Linux"/>
>> <server dn="members2.mysite.com" id="Server435" os="Fedora Core 2"/>
>>    ...
>> <server dn="members10.mysite.com" id="Server491" os="FreeBSD 4.11"/>



David

________________________________________________________________________
This e-mail has been scanned for all viruses by Star. The
service is powered by MessageLabs. For more information on a proactive
anti-virus service working around the clock, around the globe, visit:
http://www.star.net.uk
________________________________________________________________________

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.