xml-general mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Jeev...@firstlight.com
Subject How do i prevent Xalan from escaping chars in CDATA sections?
Date Mon, 08 Jan 2001 22:15:47 GMT
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>
     &lt;p&gt; a bunch of HTML
     &lt;h2&gt; it's not &quot;well-formed&quot; &lt;/h2&gt;
</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)


Mime
View raw message