I am trying to grab the li
class text in the following based on the strong tag higher up in the tree containing a certain word, in this case: "restaurants":
<p class="">The location, where the condo is situated,
offers a good choice of <strong>restaurants</strong>.
Some of them are listed below:</p>
<ul class="">
<li class="">Restaurant 1</li>
<li class="">Restaurant 2</li>
<li class="">Restaurant 3</li>
<li class="">Restaurant 4</li>
<li class="">Restaurant 5</li>
</ul>
I have tried many variations of the following, assuming that I need to go higher up the tree by using "ancestors":
//ul/li[contains(ancestor-or-self::@strong[contains(text(),'Restaurants')])