List Info

Thread: generates spurious

blocks




<para><informaltable> generates spurious <p> blocks
user name
2006-12-20 10:52:11
Hi Bob

Thanks for the very clear explanation.  (I just realised
that the second 
error - regarding the missing table elements - I actually
introduced in 
an effort to pare the test code down to a minimum.  My
original code 
included them.  Sorry about that.)

As a matter of interest, the reason I was using an
informaltable inside 
a para was that I wanted the para to be a top-level element
of a file 
(which contained a set of "Fixed Position"ed
elements) which I xincluded 
into other files.  I also needed to mark those elements in
some way and 
thought the easiest way to do that was using one of the 
"propagates.style" parameters, which limited me to
emphasis, para, 
phrase and entry.  Anyway, no matter, I can approach things
another way.

As another aside, I managed to use the para.propagates.style
feature to 
get rid of some Perl code I had previously needed to
post-process the 
XSLT output the last time I used DocBook three years ago. 
(I have been 
away sailing since then.)  Either it is a newish feature or
I missed it 
last time   It is a
pleasure to be using such a cracking toolset again.

 > The DocBook 5 RelaxNG schema can flag that table as
invalid.

Well, that's a good reason I should consider upgrading. 
Anything which 
detects errors earlier is a good thing.

Regards
Kevin

Bob Stayton wrote:
> Hi Kevin,
> Regarding the empty p elements, what you are seeing is
the result of 
> the $html.cleanup parameter triggering the unwrap.p
mode in the HTML 
> stylesheets (specifically, in xhtml/html-rtf.xsl).
>
> If you check any HTML DTD, you'll find that table (or
any other block) 
> is not a permitted child of p.  So when $html.cleanup =
1, the 
> stylesheet recursively passes through the content of
the p to close 
> the p before any such block as table, outputs the
block, and restarts 
> a new p.  The p elements before and after are not
strictly empty, they 
> each contain a single text node with the whitespace
(which is 
> preserved inside a mixed content element like para). 
In general, you 
> can expect better results by not nesting block elements
inside para 
> elements in DocBook, which avoids problems like this.
>
> Regarding the missing table elements, I'm afraid you
have a hybrid 
> table in your document. It doesn't have a tgroup, so it
isn't a CALS 
> table, but it doesn't have a tr, so it isn't an HTML
table either.  
> Unfortunately, DTD syntax doesn't permit flagging that
combination as 
> invalid because there is only one tbody declaration for
both CALS and 
> HTML tables, and DTDs can have only one content model
per element.  
> The DocBook 5 RelaxNG schema can flag that table as
invalid.  So your 
> table should work if you add the tgroup element.
>
> Bob Stayton
> Sagehill Enterprises
> DocBook Consulting
> bobssagehill.net
>
>
> ----- Original Message ----- From: "Kevin
Ruscoe" 
> <kevinsapphireofbond.org>
> To: <docbook-appslists.oasis-open.org>
> Sent: Tuesday, December 19, 2006 3:37 PM
> Subject: [docbook-apps] [BUG]
<para><informaltable> generates spurious 
> <p> blocks
>
>
>> Hi
>>
>> Given the following files...
>>
>>
============================================================
================== 
>>
>> test.dbk
>> --------
>> <?xml version="1.0"?>
>> <!DOCTYPE article PUBLIC "-//OASIS//DTD
DocBook XML V4.4//EN"
>>
>> "http://www.oasis-open.org/docbook/xml/4.4/docboo
kx.dtd">
>>
>> <article>
>>  <para>
>>    A paragraph containing text works fine.
>>  </para>
>>
>>  <para role="test">
>>    <informaltable>
>>      <tbody>
>>        <row>
>>          <entry>
>>            A paragraph containing a table produces
empty paragraph 
>> blocks
>>          </entry>
>>        </row>
>>      </tbody>
>>    </informaltable>
>>  </para>
>> </article>
>>
============================================================
================== 
>>
>> test.sh
>> -------
>> #!/bin/sh
>>
>> xsltproc -o test.xhtml 
>>
/usr/local/install/docbook-xsl/docbook-xsl-1.71.1/xhtml/docb
ook.xsl 
>> test.dbk
>>
============================================================
================== 
>>
>>
>> ...running test.sh produces the following output
>> (I have adjusted white space for readability):
>>
>>
============================================================
================== 
>>
>> test.xhtml
>> ----------
>> <?xml version="1.0"
encoding="UTF-8"?>
>> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML
1.0 Transitional//EN"
>>  "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transiti
onal.dtd">
>>
>> <html xmlns="http://www.w3.
org/1999/xhtml">
>>  <head>
>>    <meta http-equiv="Content-Type"
content="text/html; charset=UTF-8" />
>>    <title></title>
>>    <meta name="generator"
content="DocBook XSL Stylesheets V1.71.1" />
>>  </head>
>>
>>  <body>
>>    <div class="article"
lang="en" xml:lang="en">
>>      <div class="titlepage">
>>        <hr />
>>      </div>
>>      <p>
>>        A paragraph containing text works fine.
>>      </p>
>>      <p class="test">
>>      </p>
>>        <table>
>>          <tbody xmlns="">
>>            A paragraph containing a table produces
empty paragraph 
>> blocks.
>>          </tbody>
>>        </table>
>>      <p class="test">
>>      </p>
>>    </div>
>>  </body>
>> </html>
>>
============================================================
================== 
>>
>>
>> Instead of one paragraph containing the table, we
have an empty 
>> paragraph
>> before and after the table.  Also, the <tr>
and <td> elements are 
>> missing.
>> I get similar behaviour when I use the HTML
stylesheets and when I omit
>> the role attribute.
>>
>> Many apologies if I have missed something, but this
behaviour appears 
>> to be
>> a bug.
>>
>> My toolchain is as follows:
>>
>>
============================================================
================== 
>>
>> DocBook v4.4
>>
>> $ xsltproc --version
>> Using libxml 20626, libxslt 10117 and libexslt 813
>> xsltproc was compiled against libxml 20626, libxslt
10117 and 
>> libexslt 813
>> libxslt 10117 was compiled against libxml 20626
>> libexslt 813 was compiled against libxml 20626
>>
>> docbook-xsl v1.71.1
>>
============================================================
================== 
>>
>>
>> Regards
>> Kevin
>>
>>
------------------------------------------------------------
---------
>> To unsubscribe, e-mail:
docbook-apps-unsubscribelists.oasis-open.org
>> For additional commands, e-mail:
docbook-apps-helplists.oasis-open.org
>>
>>
>>
>
>
>
>
------------------------------------------------------------
---------
> To unsubscribe, e-mail: docbook-apps-unsubscribelists.oasis-open.org
> For additional commands, e-mail: docbook-apps-helplists.oasis-open.org
>
>


------------------------------------------------------------
---------
To unsubscribe, e-mail: docbook-apps-unsubscribelists.oasis-open.org
For additional commands, e-mail: docbook-apps-helplists.oasis-open.org

[1]

about | contact  Other archives ( Real Estate discussion Medical topics )