I’m trying to write an XPath query that will select an element, whose text contains given string:
<div>Text1<strong>censored</strong>Text2</div>
So the following query wont match
//div[contains(./text(), 'Text2')]/strong/text()
But this one will, the text node index is explicitly stated:
//div[contains(./text()[2], 'Text2')]/strong/text()
how do I write a query that will match any text descendent?
1 Answer