Using uppercase and lowercase xpath functions in the Selena IDE

I'm trying to get an xpath request using the xpath function in lower-case or upper-case , but it doesn't seem to work in selenium (where I check my xpath before applying it).

An example that does NOT work:

 //*[.=upper-case('some text')] 

I have no problem finding the nodes I need in a complicated way, and even using aggregate functions if I don't use upper and lower case.

Has anyone come across this before? Does this make sense?

Thank you

+24
xpath uppercase lowercase selenium-ide
Oct 26 '09 at 15:21
source share
2 answers

upper-case() and lower-case() are XPath 2.0 functions. Most likely, your platform only supports XPath 1.0.

Try:

 translate('some text','abcdefghijklmnopqrstuvwxyz','ABCDEFGHIJKLMNOPQRSTUVWXYZ') 

which is a XPath 1.0 way. Unfortunately, this requires knowledge of the alphabet that uses text. For plain English, this probably works, but if you expect accented characters, make sure you add them to the list.

+54
Oct 26 '09 at 16:45
source share

If you need uppercase in several places in xslt, you can define variables for lowercase and uppercase, and then use them throughout the translation function. This should make your xslt much cleaner.

Example in XSL / XPATH: no uppercase function in MSXML 4.0?

+2
Dec 31 '09 at 3:55
source share



All Articles