How to perform case insensitive search in XPath?
<p>I am trying to implement case insensitive search using XPath.
I have already referred <a href="https://stackoverflow.com/questions/11335558/how-to-perform-a-case-insensitive-attribute-selector-in-xquery">how to perform a case-insensitive attribute selector in xquery</a> so please check before marking as duplicate. I am using Lcase to convert my variable (<code>L_search</code>) to lowercase and lower-case functions.</p>

<p>My original case sensitive XPath expression is:</p>

<pre><code>XPath       =  "//*[contains(., '"&amp; search &amp;"')]/ancestor-or-self::*/*[local-name()='home' and @locale='en']"
</code></pre>

<p>I have tried many combinations like :</p>

<pre><code>XPath       =  "//*lower-case([contains(., '"&amp; L_search &amp;"')])/ancestor-or-self::*/*[local-name()='home' and @locale='en']"

XPath       =  "//*[contains(lower-case(.), '"&amp; L_search &amp;"')])/ancestor-or-self::*/*[local-name()='home' and @locale='en']"
</code></pre>

<p>But none of them is yielding a result.</p>

<p>This is the code I'm running:</p>

<pre><code>Sub ProcessFolder(FolderPath)
    On Error Resume Next
    Set fldr = fso.GetFolder(FolderPath)

    Set Fls = fldr.files
    For Each thing in Fls
            sFSpec = FSO.GetAbsolutePathName(thing)
            objMSXML.async = True
            objMSXML.load sFSpec
             If 0 = objMSXML.parseError Then
                Dim sXPath   : sXPath       =  "//*[contains(., '"&amp; search &amp;"')]/ancestor-or-self::*/*[local-name()='name' and @locale='en']"

                Dim querySubject : Set querySubject = objMSXML.selectSingleNode(sXPath)
                    Set p = document.createElement("p")
                        p.innerText = thing.Path
                        document.body.appendChild p
                    If querySubject Is Nothing Then
                        MsgBox sXPath, "failed"
</code></pre>