Microsoft KB Archive/315719

= INFO: Use XPath to Perform a Case-Insensitive Search with MSXML =

Article ID: 315719

Article Last Modified on 4/8/2002

-

APPLIES TO


 * Microsoft XML Core Services 4.0
 * Microsoft XML Core Services 4.0

-



This article was previously published under Q315719



SUMMARY
MSXML includes two functions that you can use to filter data in a case-insensitive search. With MSXML 3.0, you can use the translate function. With MSXML 4.0, you can use either the translate function or the new ms:string-compare XPath function.



MORE INFORMATION
To perform a case-insensitive search by a DomainName property that is named &quot;mydomain1.com&quot; on the following XML data   Mydomain1.COM  the syntax for translate in MSXML 3.0 is as follows: oXML.setProperty &quot;SelectionLanguage&quot;, &quot;XPath&quot; set node = oXML.selectSingleNode(&quot;Domains/DomainName[translate(., 'ABCDEFGHIJKLMNOPQRSTUVWXYZ', 'abcdefghijklmnopqrstuvwxyz') = 'mydomain1.com']&quot;) The syntax for ms:string-compare in MSXML 4.0 is as follows: 'To use MSXML 4.0, you need to use 4.0 dependent progid explicitly. ' ... 'Set the select namespace for xmlns:ms oXML.setProperty &quot;SelectionNamespaces&quot;, &quot;xmlns:ms='urn:schemas-microsoft-com:xslt'&quot; set node = oXML.selectSingleNode(&quot;Domains/DomainName[ms:string-compare(., 'mydomain1.com', 'en-US', 'i') = 0]&quot;)

