tags:

views:

117

answers:

1

I am trying to sort a XML doc using xsl:sort

My requirement is to ignore case while doing the sort. xsl:sort have a case-order attribute which helps specify upper-first or lower-first, which is of no help for me.

I also tried using translate function, something like this :

<xsl:sort select="translate('abcdefghijklmnopqrstuvwxyz','ABCDEFGHIJKLMNOPQRSTUVWXYZ',sortOn)" order="ascending" />";

dint work either.

Ideas are appreciated.

+2  A: 

The parameters to your translate function are in the wrong order.

<xsl:sort select="translate(sortOn 'abcdefghijklmnopqrstuvwxyz','ABCDEFGHIJKLMNOPQRSTUVWXYZ')" order="ascending" />

This function is defined as follows in the XPath spec:

Function: string translate(string, string, string)

The translate function returns the first argument string with occurrences of characters in the second argument string replaced by the character at the corresponding position in the third argument string.

Lachlan Roche
That did work. I promise next time I'll RTFM :)
Nishan