Assuming the following XML:
<?xml version="1.0" encoding="UTF-8"?>
<root>
<info>
<code>
ABC
</code>
<desc>
A
</desc>
</info>
<info>
<code>
DEF
</code>
<desc>
A
</desc>
</info>
<info>
<code>
XYZ
</code>
<desc>
B
</desc>
</info>
</root>
How can I select all of the code elements that have a desc value of ‘A’?
I tried the following XPath, and it gave me nothing:
/root/info[desc='A']
Like @Jim Garrison said, you’ll need to use
normalize-space()on<desc>but you can pretty much keep the xpath that you had with the addition of/code(andnormalize-space())