I’m trying to target data that is not located unside a tag (other than the all encompassing p)
<p>
<strong>id1:</strong>data1<br />
data2<br />
<strong>id3:</strong>data3<br />
<strong>id4:</strong>data4
</p>
<p>
<strong>id1:</strong>data1<br />
data2<br />
<strong>id3:</strong>data3
</p>
Any suggestions how I can get data1, data2, and data3 and be able to identify them uniquely (for example data3 follows the strong[.='id3:'] and ends before the <br/>)
EDIT: data2 always follows data1 after a <br/>
Thanks
To find the text node that immediately follows
<strong>id1</strong>, usestrong[.='id1']/following-sibling::text()[1](with the p element as your context node).This assumes that you know there will be such a text node. A more rigorous test is
strong[.='id1']/following-sibling::node()[1][self::text()]which will find the first node (of any kind) after the strong element, and return it provided that it turns out to be a text node.It’s not clear how you want to identify data2 in your example.