For the below xml i want to render the unescaped text parts on browser from xslt e.g.:
<one>
<text>
</one>
I want the markup rendered on browser to be:
<text>
But when I use the apply templates which looks like below
<xsl:template match="text()" mode="literalHTML">
<xsl:copy-of select=".">
</xsl:copy-of>
</xsl:template>
The above XML is getting rendered as:
<text>
How can I modify this template so that it prints <text> on browser?
Best Regards, Keshav
The "tricky recursive processing"
Result:
EDIT: A DVC pattern to avoid overflow.
I have also written a solution using recursion earlier but the only thing i was worried about was the performance and if there would be some memory or some stackoverflow because of this. I was wondering if there would be any solution using the <xsl:value-of> or <copy-of>? Also please let me know if there are any improvements possible in the below solution if the recursion could be converted to loop or etc.
This can be achieved in XSLT 1.0 using quite tricky recursive processing.
Fortunately, one can use FXSL ( a library of XSLT templates) to solve the same task in just a few minutes:
when this transformation is applied on the following XML document:
the wanted result is produced:
and it displays in the browser as:
<text>