Match Case and Exact Match in XML Document with XPath

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.


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:

With the fn:matchesfunction you write a regular expression to match your desired target string.


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.

Need Your Help

How to import a DBF file in SQL Server

sql-server foxpro dbf

How can you import a foxpro DBF file in SQL Server?

How to freeze first or first n columns of bootstrap table?

javascript html css twitter-bootstrap-3

I am trying to make table whose first column is freezed when scrolling horizontally as well as vertically.