CLiown
CLiown

Reputation: 13843

XSLT - how to deal with <![CDATA[

Im trying to output some XML using XSLT, however I've just come across this:

<description><![CDATA[<p>Using Money &ndash; recognise coins, getting change, paper money etc. A PowerPoint resource containing colour coded levels to suit different abilities &ndash; special needs. Self checking and interactive.</p>]]></description>

How do I output the actual HTML, not the <P>, but as if it was HTML?

Upvotes: 1

Views: 2019

Answers (2)

Jukka Matilainen
Jukka Matilainen

Reputation: 10188

You can use disable-output-escaping. Beware, though, that if the input value is not well-formed or valid, the output won't be either.

<xsl:value-of select="description" disable-output-escaping="yes"/>

Upvotes: 2

Jon W
Jon W

Reputation: 15806

XSLT handles data already parsed by the XML parser. The CDATA tags are parsed as text by the XML parser. You might need to do some pre-processing to remove the CDATA tags before turning over the XML to XSLT.

Upvotes: 0

Related Questions