|
[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] Re: Natural Sort
On 1/24/06, Rudi Starcevic <tech@xxxxxxxxxxxx> wrote: > Hi, > > I'm having trouble sorting my output. > > Using PHP as an example there is 'sort' and 'natural_sort' functions. > > This is my current output, I'm wanting the output to list from media1 > not from media10. > > I've searched the archives but so far I've not found anything, mostly > been searching under 'natural sort' so this could be a good one to add. > > Any advice much appreciated ... > > Sample Output: > > media10.mysite.com > media11.mysite.com > media12.mysite.com > media13.mysite.com > media14.mysite.com > media15.mysite.com > media1.mysite.com > media2.mysite.com > media3.mysite.com > media4.mysite.com > media5.mysite.com > media6.mysite.com > media7.mysite.com > media8.mysite.com > media9.mysite.com > > Sample XML: > > <servers> > <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"/> > </servers> > > Sample XSL: Substring out the number and then use that, eg: <xsl:sort select="substring-after(substring-before(@dn, '.'), 'media')" data-type="number" order="ascending"/> cheers andrew
|
PURCHASE STYLUS STUDIO ONLINE TODAY!Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced! Download The World's Best XML IDE!Accelerate XML development with our award-winning XML IDE - Download a free trial today! Subscribe in XML format
|

Cart








