This is the mail archive of the
docbook-apps@lists.oasis-open.org
mailing list .
RE: Missing CDATA sections
- From: Jeff Beal <jeff dot beal at ansys dot com>
- To: docbook-apps <docbook-apps at lists dot oasis-open dot org>
- Date: Thu, 11 Jul 2002 11:37:00 -0400
- Subject: RE: DOCBOOK-APPS: Missing CDATA sections
I'm pretty sure that most processors will throw away the <![CDATA[ and ]]>
regardless of validity, simply because the parser doesn't pass that
information along to the XSLT processor. When the parser sees the CDATA
section, it simply passes all of the characters in that section to the
processor exactly as they are.
-----Original Message-----
From: Elliotte Rusty Harold [mailto:elharo@metalab.unc.edu]
Sent: Thursday, July 11, 2002 11:17 AM
To: fyl2xp1; docbook-apps
Subject: Re: DOCBOOK-APPS: Missing CDATA sections
At 3:15 PM +0100 7/11/02, fyl2xp1 wrote:
If I process this file:
<?xml version="1.0"?>
<!DOCTYPE article PUBLIC "-//OASIS//DTD DocBook XML V4.1.2//EN"
"c:/docbook/docbkx412/docbookx.dtd">
<article>
<sect1><title>Error Prone</title>
<![CDATA[
Im going to dissapear!
]]>
<para>
Yes that's right ladies and gentlemen, CDATA is gone!
</para>
</sect1>
</article>
Wild guess: it's a style sheet issue, but also an issue with your
code. I don't think that's valid. The sect1 element does not allow
mixed content. Thus it' not a huge surprise the stylesheet throws it
away.
Remember, CDATA sections are syntax sugar. They are *not* elements.
In this case, they are not substitutes for a para. I suspect if you
wrap a para around the CDATA section like this, everything will work:
<?xml version="1.0"?>
<!DOCTYPE article PUBLIC "-//OASIS//DTD DocBook XML V4.1.2//EN"
"c:/docbook/docbkx412/docbookx.dtd">
<article>
<sect1><title>Error Prone</title>
<para>
<![CDATA[
Im going to dissapear!
]]>
</para>
<para>
Yes that's right ladies and gentlemen, CDATA is gone!
</para>
</sect1>
</article>
Debugging tip: when the stylesheets aren't giving you what you
expect, validate your documents and correct any errors you find. In
my experience this fixes about half of the problems I initially
attribute to the stylesheets.
--
+-----------------------+------------------------+-------------------+
| Elliotte Rusty Harold | elharo@metalab.unc.edu | Writer/Programmer |
+-----------------------+------------------------+-------------------+
| XML in a Nutshell, 2nd Edition (O'Reilly, 2002) |
| http://www.cafeconleche.org/books/xian2/ |
| http://www.amazon.com/exec/obidos/ISBN%3D0596002920/cafeaulaitA/ |
+----------------------------------+---------------------------------+
| Read Cafe au Lait for Java News: http://www.cafeaulait.org/ |
| Read Cafe con Leche for XML News: http://www.cafeconleche.org/ |
+----------------------------------+---------------------------------+