xml-general mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Scott_B...@lotus.com
Subject Re: How do i prevent Xalan from escaping chars in CDATA sections?
Date Mon, 08 Jan 2001 22:58:42 GMT

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.


                    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?                                       
                    respond to                                                           


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:

          <p> a bunch of HTML
          <h2> it's not "well-formed" </h2>

in my original XML file, it gets transformed into:

     &lt;p&gt; a bunch of HTML
     &lt;h2&gt; it's not &quot;well-formed&quot; &lt;/h2&gt;

I have an xsl command along these lines:

<xsl:template match="cdata_section">
<table><xsl:apply-templates /> </table>

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
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

View raw message