Reputation: 61
i am trying to get text till 1st <.hr>(ignore dot) tag using Xpath
<div class="entry">
<p> some text</p>
<p> some text2</p>
<p> some text3</p>
<p> some text4</p>
<hr>(get text part before this hr tag)
<p> some text5</p>
<hr>
<p> some text6</p>
</div>
tried this
//hr[1]/ancestor::div[@class="entry"]/text()
and some similar variants but couldn't get the expected output
Upvotes: 0
Views: 95
Reputation: 1113
Something along these lines will give you the set of nodes before the hr
node
//div[@class="entry"]/*[not(preceding-sibling::hr | self::hr)]
It will list those nodes that
hr
nodeUpvotes: 1