tags:

views:

421

answers:

3

My problem is that my XML document contains snippets of XHTML within it and while passing it through an XSLT I would like it to render those snippets without mangling them.

I've tried wrapping the snippet in a CDATA but it doesn't work since less than and greater than are translated to < and > as opposed to being echoed directly.

What's the XSL required for doing this?

A: 

xsl:copy-of

Apocalisp
+1  A: 

Assuming your xhtml is in an element YYY

http://www.dpawson.co.uk/xsl/sect2/N1930.html explains options

DaveP
+4  A: 
<xsl:template match="@*|node()">
  <xsl:copy>
    <xsl:apply-templates select="@*|node()"/>
  </xsl:copy>
</xsl:template>

This is referred to as the "identity transformation" in the XSLT specification.

Greg Hewgill