开发者

Ignore case while doing xsl:sort

开发者 https://www.devze.com 2022-12-20 23:52 出处:网络
I am trying to sort a XML d开发者_StackOverflow中文版oc 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 lo

I am trying to sort a XML d开发者_StackOverflow中文版oc 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.


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.


How about <xsl:sort select="lower-case(sortOn)"/> ?

0

精彩评论

暂无评论...
验证码 换一张
取 消