Subject: RE: unparsed CDATA maintain HTML
From: "Andreas L. Delmelle" <a_l.delmelle@xxxxxxxxxx>
Date: Sun, 14 Dec 2003 18:27:29 +0100
|
> -----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 <
> > 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 < and > in the text element, so your text looks like :
<text>I <i>have</i> to add some <b>HTML</b> 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
|