Search code examples
xsltxpathxqueryxslt-1.0case-insensitive

XSLT 1 - find child node where node has case-insensitive value


I have the following selector, which works:

parent::node()/myNS:expField[myNS:Nam='NAMETOFIND']/myNS:Val

What I want is to do case-insensitive matching on the myNS:Nam value, so I would be able to select <Val> from any of the following:

<expField>
    <Nam>NAMETOFIND</Nam>
    <Val>the value I want</Val>
</expField>
<expField>
    <Nam>NameToFind</Nam>
    <Val>the value I want</Val>
</expField>
<expField>
    <Nam>nametofind</Nam>
    <Val>the value I want</Val>
</expField>
<expField>
    <Nam>nAmEtOFInD</Nam>
    <Val>the value I want</Val>
</expField>

I'm using XSLT 1, so I can't use lower-case().


Solution

  • translate() will do the job, it's not pretty but it works. If you know what language you want to process, that is.