Click to See Complete Forum and Search --> : [RESOLVED] Case insensitive string comparison with XSLT


monalin
July 20th, 2009, 01:12 PM
Right now I'm matching a case insensitive string like this. I'm wondering if there is an easier way to ignore case when comparing strings in an XSL transform file. I've looked everywhere this is the only way I've seen to do it. Seems there should be a more elegant solution.

translate(@type,'ABCDEFGHIJKLMNOPQRSTUVWXYZ','abcdefghijklmnopqrstuvwxyz') = 'combobox2'

Alsvha
July 21st, 2009, 02:00 AM
Depending on which XSL engine you use, then you can perhaps utilize scripts in it.
For example if using .NET you can do something like this: http://www.svelmoe.dk/post/Using-scripts-in-XSLT
I suspect similar exists for Java.

It is not the worlds most elegant solution to the problem, but using scripts in XSLT have solved many of my problems much more elegant and faster then otherwise.

monalin
July 21st, 2009, 09:26 AM
Perfect, just what i was looking for, i love it thanks. Using .NET so wont be any problems using this example.