Reputation: 1
I have some formatted text in XML within CDATA tag. XSLT puts this data in table of columns Attribute Name & Attribute Value. Attribute Value has CDATA tag but when its added to table it does not display formatted text. Instead it displays "<p> <strong> <span style="color:#FF8C00;">Test data for this requirementlt;/span> </strong> </p>" It should display like below
Can someone help me with solution?
Upvotes: 0
Views: 335
Reputation: 163282
The CDATA tag tells the XML parser not to parse the content. So if you want it parsed, you need to extract it from the CDATA section and submit it to a second parsing run. With a modern XSLT processor you can do this using a function call such as parse-xml(), but with older processors you will need to call an extension function.
If you want to simply copy the content of the CDATA section to the serialized output, without modification and without escaping the markup, then you might be able to use <xsl:value-of select="..." disable-output-escaping="yes"/>
. However, this only works if the transformation output is being sent to a serializer: which isn't the case, for example, with some browsers.
Upvotes: 1