November 29, 2010

XPath Query - Perform a case insensitive comparison

To perform a case insensitive comparison you may use the function : CompareCaseInsensitive.

Example:
/sitecore/content//*[CompareCaseInsensitive(@@myfield,'MyValue')]


If you need to compare the field 'name' case insensitively you may use 'key' in place of 'name'.
Example:
/sitecore/content//*[@@key,'myvalue')]


Important: the search value has to be lower case!


All the XPath query function are available in Sitecore.Data.Query.Functions

No comments:

Post a Comment