How to match the case in xml node data. I need to search the xml node data and match the given string with xml node data. Matching is required on:
- Match Case
- Exact Match
Any help in this regard is warmly welcom.
How to match the case in xml node data. I need to search the xml node data and match the given string with xml node data. Matching is required on:
Any help in this regard is warmly welcom.
The functions lower-case() and upper-case() are only available in XPath 2.0 and upper versions.
In XPath 1.0 for case-insensitive string comparison use:
translate($string1, 'ABCDEFGHIJKLMNOPQRSTUVWXYZ', 'abcdefghijklmnopqrstuvwxyz')
=
translate($string2, 'ABCDEFGHIJKLMNOPQRSTUVWXYZ', 'abcdefghijklmnopqrstuvwxyz')
where $string1 and $string2 are expressions specifying the strings to be compared.
You may want to have a look at section 7.6.2 of the XPath spec:
http://www.w3.org/TR/xpath-functions/#func-matches
With the fn:matchesfunction you write a regular expression to match your desired target string.
Cheers,
Try lower-case or upper-case String functions. That's not quite the same as case-insensitive, but hopefully it will be close enough:
//YourNode[lower-case(@title)='anders rostgaard bystru']
see this post for other solutions.