Forum Moderators: open

Message Too Old, No Replies

XSL parsing of HTML tags in <![cdata[.]]>

Styling atom:summary

         

eSite

4:06 am on Sep 10, 2006 (gmt 0)



Hi, I'm trying to style my Atom 1.0 feed.
I need to use <![cdata[...]]> to prevent special characters to create a parse error.
But then HTML tags aren't parsed as HTML when I view the feed with its XSL.


<summary type="xhtml">
<![cdata[
<div xmlns="http://www.w3.org/1999/xhtml">
my content
</div>
]]>
</summary>

I tried several variations of

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

taking eample on feedburner [feeds.feedburner.com...]
I also read this other thread "insert HTML in an XML document" [webmasterworld.com...]

choster

6:05 pm on Sep 11, 2006 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



When you add <![cdata[.]]> markers, you're instructing the system "do not parse anything inside." That is why the sample code you provided will output a text stream.

In this case I believe you can add a cdata-section-elements attribute to your <xsl:output /> definition to specify elements whose contents the parser should ignore.

Incidentally, if you want to preserve node structure, you wouldn't use <xsl:value-of />, but rather <xsl:copy-of />.