Hi,
I think this is a bug in the code that is triggered by the stylesheet param 'html.cleanup' = 1 (the default value). That code tries to resolve situations where a <p> would be contained inside a <p> in the output, due to the structure of the XML input, creating invalid HTML. There exist a bunch of templates in html/html-rtf.xsl in mode="unwrap.p" that are executed recursively to try to "unwrap" such nested <p> elements into sequential <p> elements. Such unwrapping is always kind of tricky. In this case, it gets it wrong, but the code is not very well documented so I cannot easily tell where it is going wrong.

The formalpara element in general tries to create a run-in heading in a para, so it already is messing with the <para> element in the input to mix the <title> text with the <para> in a single <p> output. Maybe that is not accounted for in mode="unwrap.p".

I do know that:

a.  The extra <p> element is empty, and does not display in the HTML output.

b. If you set html.cleanup=0, the problem goes away. However, I'm not sure what other problems that setting might introduce.

c. Since the stylesheet cannot output a run-in heading on a list, you could change your input to put the title on itemizedlist as follows:

  <?xml version="1.0"?>
  <!DOCTYPE appendix PUBLIC "-//OASIS//DTD DocBook XML V5.1b2//EN"
  "http://www.oasis-open.org/docbook/xml/5.1b2/dtd/docbook.dtd";>
  <appendix
     version     = "5.1"
     xml:lang    = "en"
     xmlns       = "http://docbook.org/ns/docbook";>
    <!-- <title role="hide">Hidden Title</title> -->
        <itemizedlist>
          <title>This is the title of a formalpara.</title>
          <listitem><para>List item 1.</para></listitem>
          <listitem><para>List item 2.</para></listitem>
        </itemizedlist>
  </appendix>

In this case, this markup is a better match to what you are trying to do than formalpara.

Bob Stayton
Sagehill Enterprises
[email protected]


----- Original Message ----- From: "William R. Greene" <[email protected]>
To: <[email protected]>
Sent: Friday, July 01, 2011 8:42 PM
Subject: [docbook-apps] Possible formalpara bug


I am using DocBook 5.1b2 with the DocBook XSL-NS Stylesheets 1.76.1. I have noticed that translating a <formalpara> with a <title> results in two <p>s in the generated XHTML 1.1. Here is the DocBook source (try.docbook):

  <?xml version="1.0"?>
  <!DOCTYPE appendix PUBLIC "-//OASIS//DTD DocBook XML V5.1b2//EN"
  "http://www.oasis-open.org/docbook/xml/5.1b2/dtd/docbook.dtd";>
  <appendix
     version     = "5.1"
     xml:lang    = "en"
     xmlns       = "http://docbook.org/ns/docbook";>
    <!-- <title role="hide">Hidden Title</title> -->
    <formalpara>
      <title>This is the title of a formalpara.</title>
      <para>
        <itemizedlist>
          <listitem><para>List item 1.</para></listitem>
          <listitem><para>List item 2.</para></listitem>
        </itemizedlist>
      </para>
    </formalpara>
  </appendix>

I translate the DocBook source thus:

  xsltproc vendor/docbook-xsl-ns/xhtml-1_1/docbook.xsl try.docbook

The generated XHTML (prettied-up) is this:

  <?xml version="1.0" encoding="utf-8"?>
  <html xmlns="http://www.w3.org/1999/xhtml";>
    <head>
      <title>Appendix A. </title>
      <meta name="generator" content="DocBook XSL-NS Stylesheets V1.76.1"/>
    </head>
    <body>
      <div xml:lang="en" class="appendix" title="Appendix A. ">
        <div class="titlepage"/>
        <p title="This is the title of a formalpara.">
          <strong>This is the title of a formalpara. </strong>
        </p>
        <div class="itemizedlist">
          <ul class="itemizedlist">
            <li class="listitem"><p>List item 1.</p></li>
            <li class="listitem"><p>List item 2.</p></li>
          </ul>
        </div>
        <p title="This is the title of a formalpara."/>
      </div>
    </body>
  </html>

Why is '<p title="This is the title of a formalpara."' generated twice? Is this a bug in the 1.76.1 stylesheets?

  -- Bill Greene



---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to