This could be really tricky or really easy, depending on the exact data - how much can you share about the actual nodeNames? Are they just like that, or could they be anything?
The trick to this is that you can use more than one <sort> statement - so you could have the first be an expression that resolve to a boolean, to determine if the current nodeName is numeric or textual, e.g.:
Hmm - Then the only thing I can think of right now, would be to use the translate() function to change the digits 0-9 into characters higher in the Unicode set (there's a range reserved for "private use" - cool, right :-)
Sorting alphabetically first numeric second?
I need to sort a set of nodes alphabetically first numeric second...
I use the standard
<xsl:sort select="@nodeName" order="ascending" />
this out putsnodes in this form:
1-2-3-a-b-c
What i need to output is:
a-b-c-1-2-3
Hi Claus,
This could be really tricky or really easy, depending on the exact data - how much can you share about the actual nodeNames? Are they just like that, or could they be anything?
/Chriztian
The trick to this is that you can use more than one <sort> statement - so you could have the first be an expression that resolve to a boolean, to determine if the current nodeName is numeric or textual, e.g.:
This would return either 1 or 0 (because number(@nodeName) will return 'NaN' for any non-numeric string)
But that will only work if the nodeNames to treat as numeric are "clean" numbers...
/Chriztian
The are not clean numbers :(
They are like "1-form", "50/50" and like that...
Hmm - Then the only thing I can think of right now, would be to use the translate() function to change the digits 0-9 into characters higher in the Unicode set (there's a range reserved for "private use" - cool, right :-)
Try this sort statement:
/Chriztian
Wow, that was simple :) i was getting ready for somethin really advanced :)
is working on a reply...