[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

RE: unparsed CDATA maintain HTML

Subject: RE: unparsed CDATA maintain HTML
From: "Andreas L. Delmelle" <a_l.delmelle@xxxxxxxxxx>
Date: Sun, 14 Dec 2003 18:27:29 +0100
cdata in html
> -----Original Message-----
> From: George @dante
>
> lets say for a reason (maybe a wrong one) we have an XML file
> that contains
> a text element
>
> <text><![CDATA[I <i>have/<i> to add some <b>HTML</b> here is ]]></text>
>
> and at the result XHTML I want to maintain these. I thought that CDATA
> should be enough and applying templates would maintain these but
> I get &lt;
> &gt; and that resulting to the <i>s and <b>s being shown as at the end
>

Enclosing <> in <!CDATA[]> basically comes down to the same thing as having
raw &lt; and &gt; in the text element, so your text looks like :

<text>I &lt;i&gt;have&lt;/i&gt; to add some &lt;b&gt;HTML&lt;/b&gt; here is
</text>

to the parser.

Question is whether you really need that. Since your handling XML anyway,
there's no reason you couldn't just have this in your source file:

<text>I <i>have</i> to add some <b>HTML</b> here is </text>

and a simple <xsl:copy-of select="." /> in the template for handling
'text'-elements, will result in the above being copied into the result
document.

Alternatively, you could use 'disable-output-escaping', but that's only to
be used as a last resort. I think you're way better of removing the
<!CDATA[]> markup altogether (if possible).


Cheers,

Andreas


 XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list


Current Thread

PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.