Use xsl:disable-output-escaping="yes". See
http://www.w3.org/TR/xslt.html#disable-output-escaping. CDATA sections
aren't part of the XSLT data model, they are only a parsing mechanism, so
the XSLT processor doesn't/shouldn't do anything magic with them.
-scott
JeevanK@first
light.com To: general@xml.apache.org
cc: (bcc: Scott Boag/CAM/Lotus)
01/08/01 Subject: How do i prevent Xalan from escaping
chars in CDATA
05:15 PM sections?
Please
respond to
general
Hello,
I have an XML file with a CDATA section. The CDATA section includes a
bunch of HTML, some of which is ill-formed according to XML standards. I
want to translate this xml file, leaving the CDATA completely intact, tags
and all.
Unfortunately, when I try this, all the <'s, >'s, and other escapable
characters get turned into their respective character references. That is
to say, if I have:
<cdata_section>
<![CDATA[
<p> a bunch of HTML
<h2> it's not "well-formed" </h2>
]]>
</cdata_section>
in my original XML file, it gets transformed into:
<table>
<p> a bunch of HTML
<h2> it's not "well-formed" </h2>
</table>
I have an xsl command along these lines:
<xsl:template match="cdata_section">
<table><xsl:apply-templates /> </table>
</xsl:template>
instead of <xsl:apply-templates />, i've tried <xsl:value-of select="." />
and <xsl:copy-of select="." /> but the result is the same.
All the tag-like characters have been transformed into their references.
I've tried messing with OutputFormats (making cdata_section a
nonEscapingElement and such) and changing the entities file in the xsl
stylesheet to no avail.
Any help? There's got to be an option or a switch buried amidst the code
somewhere to disable this unwanted translation, right? I found nothing that
worked in the API docs. I'm trying to pass this data through so that the
parser doesn't barf on ill-formed tags and so that the data can eventually
be properly displayed in an HTML browser.
Apologies for the lengthiness of this post.
you can respond directly to jeevank@firstlight.com if you'd like.
thanks in advance,
jeevan kalanithi
First Light Communications
jeevank@firstlight.com
212.766.2380 (p)
212.766.2379 (f)
---------------------------------------------------------------------
In case of troubles, e-mail: webmaster@xml.apache.org
To unsubscribe, e-mail: general-unsubscribe@xml.apache.org
For additional commands, e-mail: general-help@xml.apache.org
|