My problem is that i need to retrieve original html from XPath expressions designed to get text parts of html.
For example if i got the current html :
<div class='text'>
<p class='nointerrest'> blabla </p>
<p class='goodstuff'> blablabla </p>
<p class='goodstuff'> blablabla </p>
</div>
Then my XPath expression is the string :
string-join(//p[@class='goodstuff'],' ')
which give me :
"blablabla blablabla"
is there an XPath expression which can return me :
<p class='goodstuff'> blablabla </p>
<p class='goodstuff'> blablabla </p>
as a string ? (If possible with an XPath expression the most similar to my original XPath expression )
Thanks in advance
You’ll need more than just XPath to get the desired output. XPath is a document query language, not an XML formatting language, so you should think of this in distinct steps.
First, use XPath to query the document for a
NodeList:Then create a
Transformer:And use it to output each node: