I have the following html:
<td>
<h1>Headline</h1><br>
<strong>Subheadline</strong><br>
Text1<br>
Text2
<h2>Subheadline2</h2>
<div>stuff</div>
<div>more stuff!</div>
</td>
I'm trying to grab "Text1" and "Text2".
After experimenting with Xpath (DOMXPath using php), I've
discovered that "td/text()[2]"
matches Text1
and "td/text()[3]"
matches Text2
I want to somehow concat them using Xpath, is it possible?
I can't seem to find proper documentation for this anywhere.
W3schools has some examples but this is really not enough.
The concat() function does what you're trying to do, I believe. Something like concat(/td/text()[2], /td/text()[3])
should work.
I cleaned up your HTML (made all the <br> tags <br/>) and was able to do it with the concat function in OxygenXML.