Tag Archives: XML

CDATA Run

I had to write an XML transform today that included CDATA, passed though exactly as received without encoding or escaping characters. It had been awhile, so I dug through an old project to find the incantation – ah: cdata-section-elements. ┬áJust include that magic word in xsl:output, listing the elements to pass through, like so:

<xsl:output 
   method="xml" 
   indent="yes" 
   encoding="UTF-8"
   cdata-section-elements="myPassThroughData" />

BTW, this tool is quite helpful when fiddling with XSLT fragments: http://xslttest.appspot.com/.