2

I'm trying to get the content in article/div/p but only the date after the <br> tag. How is that done?

<article>
    <h2>Man rescued after falling into Crater Lake</h2>
    <p class="summary highlight">
        Man rescued after falling 800 feet into Crater Lake in Oregon
    </p>

    <div class="body">
       <p>by Joe Sutton<br>
            June 11, 2019
        </p>
    </div>
</article>
$expression = "article/div/p";
kjhughes
  • 106,133
  • 27
  • 181
  • 240
Karl Hill
  • 12,937
  • 5
  • 58
  • 95

1 Answers1

1

This XPath,

//br/following-sibling::text()

will select all following sibling text nodes after br.

kjhughes
  • 106,133
  • 27
  • 181
  • 240