Re: DOCBOOK-APPS: Missing CDATA sections

From
Elliotte Rusty Harold <>
Date
2002-07-11T15:29:53+00:00
ID
p04330101b953511a6166@[192.168.254.4]
Thread
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 |  | 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/    |
+----------------------------------+---------------------------------+