Given the following XML:
<root>
<li><span>abcText1cba</span></li>
<li><span>abcText2cba</span></li>
</root>
I want to select all li elements having a span child node containing an inner text of Text1 - using an XPath.
I started off with /root/li[span] and then tried to further check with: /root/li[span[contains(text(), 'Text1')]]
However, this does not return any nodes. I fail to see why, can somebody help me out?


/li[contains(span, 'Text1')]Is a bit more elegant and shorter. You certainly con't need thetext(), just use.as it will be automatically converted to an atomic value. - dirkk