XPath: contains(./text(), 'str') will look only into the first text descendent
I'm trying to write an XPath query that will select an element, whose text con开发者_C百科tains 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?
//div[text()[contains(., 'Text2')]]/strong/text()
精彩评论