Im making a XSL transform. The XML I'm transforming has a node which contains html.
<xml>
<text>
<p><b>Hello</b><em>There</em></p>
</text>
</xml>
Applying the transform:
<xsl:template match="text">
<div class="{name()} input">
<xsl:value-of select="."/>
</div>
</xsl:template>
I get the output:
<div class="text input">
Hello There
</div>
But I want the Html to remain intact like so:
<div class="text input">
<p><b>Hello</b><em>There</em></p>
</div>
Substituting . with the node() function gives the same result.
Is there a method of getting the HTML through the transform unmodified?
Have a look at xsl:copy-of
It should do what you need..
<xsl:copy-of select="." />
The above will select the whole current node so in your case the <text>
itself will be included..
Use the following to select everything under the current..
<xsl:copy-of select="child::node()" />
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With