docbook-apps

  • 1.  Problem with tables and roundtrip to WordML

    Posted 02-28-2011 20:17
    I'm trying to convert a very simple docbook file to WordML using the
    roundtrip XSL stylesheets. I'm having trouble with tables: all cell
    contents are missing after the conversion.

    Here is my input document:

    "-//OASIS//DTD DocBook XML V4.5//EN" "http://www.oasis-open.org/doc\
    book/xml/4.5/docbookx.dtd">


    <tgroup cols="2">
    <colspec colname='c1'/><colspec colname='c2'/>
    <row><entry>a1</entry><entry>a2</entry></row>
    <row><entry>b1</entry><entry>b2</entry></row>
    </tgroup>



    This renders ok in HTML with:

    xsltproc --path .../docbook-xsl/html -o test.html \
    docbook.xsl test.xml

    but with this:

    xsltproc --path .../docbook-xsl/roundtrip -o test.wml \
    --stringparam wordml.template template.xml \
    dbk2wordml.xsl test2.xml

    the cells in the resulting table are all empty, i.e. the resulting WordML
    looks like:

    <w:tc>
    <w:tcPr>
    <w:tcW w:w="" w:type="dxa"/>
    </w:tcPr>
    <w:p/>
    </w:tc>

    I get the same result with either xsltproc or saxon. I am using
    docbook-xsl-1.76.1.

    My long term goal is to be able to programmatically generate reports as
    templated, styled Word documents from asciidoc source files, with docbook as
    an intermediate format, in a linux environment. I need relatively few
    features: headers, body text, simple bullet lists, PNG images, and
    reasonably professional-looking tables (where that means I need control over
    column alignment and borders).

    -- Dave



  • 2.  Re: [docbook-apps] Problem with tables and roundtrip to WordML

    Posted 02-28-2011 20:56
    Hi David,

    Although I have not yet checked, I believe the problem is that the content of the cells is not in a <para>. That is, your DocBook should look like:

    <row><entry><para>a1</para></entry><entry><para>a2</para></entry></row>
    <row><entry><para>b1</para></entry><entry><para>b2</para></entry></row>

    As for being able to produce professional looking tables, there is some work to do in setting up table column widths and borders properly. However, YMMV.

    Cheers,
    Steve Ball

    On 01/03/2011, at 7:16 AM, David Hinds wrote:

    > I'm trying to convert a very simple docbook file to WordML using the roundtrip XSL stylesheets. I'm having trouble with tables: all cell contents are missing after the conversion.
    >
    > Here is my input document:
    >
    > > book/xml/4.5/docbookx.dtd">
    >

    >
    > <tgroup cols="2">
    > <colspec colname='c1'/><colspec colname='c2'/>
    > <row><entry>a1</entry><entry>a2</entry></row>
    > <row><entry>b1</entry><entry>b2</entry></row>
    > </tgroup>
    >

    >

    >
    > This renders ok in HTML with:
    >
    > xsltproc --path .../docbook-xsl/html -o test.html \
    > docbook.xsl test.xml
    >
    > but with this:
    >
    > xsltproc --path .../docbook-xsl/roundtrip -o test.wml \
    > --stringparam wordml.template template.xml \
    > dbk2wordml.xsl test2.xml
    >
    > the cells in the resulting table are all empty, i.e. the resulting WordML looks like:
    >
    > <w:tc>
    > <w:tcPr>
    > <w:tcW w:w="" w:type="dxa"/>
    > </w:tcPr>
    > <w:p/>
    > </w:tc>
    >
    > I get the same result with either xsltproc or saxon. I am using docbook-xsl-1.76.1.
    >
    > My long term goal is to be able to programmatically generate reports as templated, styled Word documents from asciidoc source files, with docbook as an intermediate format, in a linux environment. I need relatively few features: headers, body text, simple bullet lists, PNG images, and reasonably professional-looking tables (where that means I need control over column alignment and borders).
    >
    > -- Dave
    >
    >




  • 3.  Re: [docbook-apps] Problem with tables and roundtrip to WordML

    Posted 02-28-2011 22:10
    On Tue, 1 Mar 2011 07:56:03 +1100, Steve Ball <Steve.Ball@explain.com.au>
    wrote:
    > Although I have not yet checked, I believe the problem is that the
    content
    > of the cells is not in a <para>. That is, your DocBook should look like:
    >
    >
    <row><entry><para>a1</para></entry><entry><para>a2</para></entry></row>
    >
    <row><entry><para>b1</para></entry><entry><para>b2</para></entry></row>

    FWIW, the DocBook 5 standard explicitly allows for text inside <entry>s,
    without a <para> tag:
    http://www.docbook.org/tdg5/en/html/entry.html#children
    I believe earlier versions of DocBook also allowed "inline" elements,
    including text; see the discussion of "Pernicious Mixed Content" here:
    http://www.docbook.org/tdg/en/html/entry.html

    Mike Maxwell



  • 4.  Re: [docbook-apps] Problem with tables and roundtrip to WordML

    Posted 02-28-2011 22:43
    Ahh, that helps. Previously, I'd been using asciidoc's docbook output,
    which uses <simpara> in table cells, but that also didn't work. I'd based
    my minimalist example on the sample table markup at
    http://www.docbook.org/tdg/en/html/table.html, which does not use the <para>
    tag.

    I'm expecting that getting table formatting right is going to take some
    work.

    -- Dave


    On Mon, Feb 28, 2011 at 12:56 PM, Steve Ball <Steve.Ball@explain.com.au>wrote:

    > Hi David,
    >
    > Although I have not yet checked, I believe the problem is that the content
    > of the cells is not in a <para>. That is, your DocBook should look like:
    >
    > <row><entry><para>a1</para></entry><entry><para>a2</para>
    > </entry></row>
    > <row><entry><para>b1</para></entry><entry><para>b2</para>
    > </entry></row>
    >
    > As for being able to produce professional looking tables, there is some
    > work to do in setting up table column widths and borders properly. However,
    > YMMV.
    >
    > Cheers,
    > Steve Ball
    >
    > On 01/03/2011, at 7:16 AM, David Hinds wrote:
    >
    > I'm trying to convert a very simple docbook file to WordML using the
    > roundtrip XSL stylesheets. I'm having trouble with tables: all cell
    > contents are missing after the conversion.
    >
    > Here is my input document:
    >
    > > "-//OASIS//DTD DocBook XML V4.5//EN" "http://www.oasis-open.org/doc\
    > book/xml/4.5/docbookx.dtd">
    >

    >
    > <tgroup cols="2">
    > <colspec colname='c1'/><colspec colname='c2'/>
    > <row><entry>a1</entry><entry>a2</entry></row>
    > <row><entry>b1</entry><entry>b2</entry></row>
    > </tgroup>
    >

    >

    >
    > This renders ok in HTML with:
    >
    > xsltproc --path .../docbook-xsl/html -o test.html \
    > docbook.xsl test.xml
    >
    > but with this:
    >
    > xsltproc --path .../docbook-xsl/roundtrip -o test.wml \
    > --stringparam wordml.template template.xml \
    > dbk2wordml.xsl test2.xml
    >
    > the cells in the resulting table are all empty, i.e. the resulting WordML
    > looks like:
    >
    > <w:tc>
    > <w:tcPr>
    > <w:tcW w:w="" w:type="dxa"/>
    > </w:tcPr>
    > <w:p/>
    > </w:tc>
    >
    > I get the same result with either xsltproc or saxon. I am using
    > docbook-xsl-1.76.1.
    >
    > My long term goal is to be able to programmatically generate reports as
    > templated, styled Word documents from asciidoc source files, with docbook as
    > an intermediate format, in a linux environment. I need relatively few
    > features: headers, body text, simple bullet lists, PNG images, and
    > reasonably professional-looking tables (where that means I need control over
    > column alignment and borders).
    >
    > -- Dave
    >
    >
    >
    >



  • 5.  Re: [docbook-apps] Problem with tables and roundtrip to WordML

    Posted 03-20-2011 17:12
    Incidentally, I did get tables working fairly well without too much work,
    though I can't vouch much for how I did it, due to my limited XSL knowledge.

    In dbk2wp.xsl, my changes were:
    - implement an 'align' parameter for <para> and <simpara> elements to be
    passed to make-paragraph
    - changed the <entry> template to recognize the align= attribute and pass it
    through the call to apply-templates for the cell contents
    - changed the template to pass a role= attribute to make-table as
    the 'style' parameter

    In dbk2wordml.xsl, my changes were:
    - in make-paragraph, use 'align' to generate a paragraph alignment element
    - in make-table, use 'style' parameter to select a table style

    As straight bug fixes, there are several spots where <simpara> elements are
    not handled properly (i.e., in <entry> and <listitem>), so I made trivial
    fixes to those templates. There also seem to be a couple spots in
    dbk2wp.xsl where apply-templates is missing a mode='doc.body' attribute (in
    the templates for admonitions and for varlistentry). Without that, I get
    errors like "simpara encountered in note, but no template matches", or
    "varlistentry encountered in variablelist, but no template matches".

    I'm actually working with stylesheets that were modified to generate Word
    2007 OOXML, that I found here:

    http://www.brians-brain.org/projects/org-to-docx.html

    There seems to be little development activity on these stylesheets, so I'm
    not sure how to proceed from here. Some of my changes would apply easily to
    the official distribution, though I have not tried to implement the reverse
    transformations since I don't have a need for those. Are patches welcome?

    -- Dave



    On Mon, Feb 28, 2011 at 12:56 PM, Steve Ball <Steve.Ball@explain.com.au>wrote:

    > Hi David,
    >
    > Although I have not yet checked, I believe the problem is that the content
    > of the cells is not in a <para>. That is, your DocBook should look like:
    >
    > <row><entry><para>a1</para></entry><entry><para>a2</para>
    > </entry></row>
    > <row><entry><para>b1</para></entry><entry><para>b2</para>
    > </entry></row>
    >
    > As for being able to produce professional looking tables, there is some
    > work to do in setting up table column widths and borders properly. However,
    > YMMV.
    >
    > Cheers,
    > Steve Ball
    >
    > On 01/03/2011, at 7:16 AM, David Hinds wrote:
    >
    > I'm trying to convert a very simple docbook file to WordML using the
    > roundtrip XSL stylesheets. I'm having trouble with tables: all cell
    > contents are missing after the conversion.
    >
    > Here is my input document:
    >
    > > "-//OASIS//DTD DocBook XML V4.5//EN" "http://www.oasis-open.org/doc\
    > book/xml/4.5/docbookx.dtd">
    >

    >

    > <tgroup cols="2">
    > <colspec colname='c1'/><colspec colname='c2'/>
    > <row><entry>a1</entry><entry>a2</entry></row>
    > <row><entry>b1</entry><entry>b2</entry></row>
    > </tgroup>
    >

    >
    >
    > This renders ok in HTML with:
    >
    > xsltproc --path .../docbook-xsl/html -o test.html \
    > docbook.xsl test.xml
    >
    > but with this:
    >
    > xsltproc --path .../docbook-xsl/roundtrip -o test.wml \
    > --stringparam wordml.template template.xml \
    > dbk2wordml.xsl test2.xml
    >
    > the cells in the resulting table are all empty, i.e. the resulting WordML
    > looks like:
    >
    > <w:tc>
    > <w:tcPr>
    > <w:tcW w:w="" w:type="dxa"/>
    > </w:tcPr>
    > <w:p/>
    > </w:tc>
    >
    > I get the same result with either xsltproc or saxon. I am using
    > docbook-xsl-1.76.1.
    >
    > My long term goal is to be able to programmatically generate reports as
    > templated, styled Word documents from asciidoc source files, with docbook as
    > an intermediate format, in a linux environment. I need relatively few
    > features: headers, body text, simple bullet lists, PNG images, and
    > reasonably professional-looking tables (where that means I need control over
    > column alignment and borders).
    >
    > -- Dave
    >
    >
    >
    >



  • 6.  Re: [docbook-apps] Problem with tables and roundtrip to WordML

    Posted 03-21-2011 09:20
    Hi David,

    Patches certainly are welcome. I'm doing some work on the roundtrip system right now, so I can get those modifications into the official release fairly soon.

    Cheers,
    Steve Ball




  • 7.  Re: [docbook-apps] Problem with tables and roundtrip to WordML

    Posted 03-21-2011 09:43
    Hi Steve,

    On Mon, Mar 21, 2011 at 10:19 AM, Steve Ball <Steve.Ball@explain.com.au> wrote:
    > Patches certainly are welcome. I'm doing some work on the roundtrip system right now, so I can get those modifications into the official release fairly soon.

    Are you working on these ones ?

    http://sourceforge.net/tracker/?func=detail&aid=3197293&group_id=21935&atid=373747

    and

    http://sourceforge.net/tracker/?func=detail&aid=3231485&group_id=21935&atid=373747

    They have no patch, but let me know if you need more info.

    Thanks
    --
    Mathieu



  • 8.  Re: [docbook-apps] Problem with tables and roundtrip to WordML

    Posted 03-21-2011 21:11
    Hi Mathieu,

    Yes, I have those bug reports and will be developing fixes ASAP.

    Cheers,
    Steve Ball

    On 21/03/2011, at 8:42 PM, Mathieu Malaterre wrote:

    > Hi Steve,
    >
    > On Mon, Mar 21, 2011 at 10:19 AM, Steve Ball <Steve.Ball@explain.com.au> wrote:
    >> Patches certainly are welcome. I'm doing some work on the roundtrip system right now, so I can get those modifications into the official release fairly soon.
    >
    > Are you working on these ones ?
    >
    > http://sourceforge.net/tracker/?func=detail&aid=3197293&group_id=21935&atid=373747
    >
    > and
    >
    > http://sourceforge.net/tracker/?func=detail&aid=3231485&group_id=21935&atid=373747
    >
    > They have no patch, but let me know if you need more info.
    >
    > Thanks
    > --
    > Mathieu
    >




  • 9.  Re: [docbook-apps] Problem with tables and roundtrip to WordML

    Posted 03-22-2011 23:29
    Had you been planning to work on any specific improvements, or mainly bug
    fixes? One thing I wanted to get working was spans for table cells, mainly
    column spans. There are some bits and pieces of code for doing this in the
    current stylesheets, but they don't seem to be complete.

    -- Dave


    On Mon, Mar 21, 2011 at 2:19 AM, Steve Ball <Steve.Ball@explain.com.au>wrote:

    > Hi David,
    >
    > Patches certainly are welcome. I'm doing some work on the roundtrip system
    > right now, so I can get those modifications into the official release fairly
    > soon.
    >
    > Cheers,
    > Steve Ball
    >
    >