On 1/24/06, Rudi Starcevic <tech(_at_)wildcash(_dot_)com> 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
--~------------------------------------------------------------------
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: <mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--