Ignore case when doing xsl: sort

I am trying to sort an XML document using xsl: sort

My requirement is to ignore case when doing sorting. xsl: sort has a case-order attribute that helps indicate top-first or bottom-first, which doesn't help me.

I also tried using the translation function, something like this:

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

also works.

Ideas appreciated.

+3
source share
2 answers

The parameters for your translation function are in the wrong order.

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

This function is defined as follows in the XPath specification :

Function: string translate (string, string, string)

, .

+5

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

0

Source: https://habr.com/ru/post/1733306/


All Articles