docbook-apps

  • 1.  centered table problem

    Posted 05-08-2010 15:37
    Hi all (especially Bob)

    I have a problem centering a table on a page of FO-->PDF output using
    XEP 4.18 (Saxon 6.5.5 and latest Docbook 5 NS style sheet)

    With no customization this table gives the expected result - see
    attached file not_centered.jpg




    version="5.0" xml:lang="EN">
    <info></info>
    <sect1 xml:id="SECT1" xmlns="http://docbook.org/ns/docbook"></sect1>
    version="5.0" xml:lang="EN">
    <info></info>
    <sect2 xml:id="SECT2" xmlns="http://docbook.org/ns/docbook"></sect2>
    version="5.0" xml:lang="EN">
    <info></info>


    <info></info>

    <tgroup align="center" cols="4" colsep="1" rowsep="1">
    <colspec colname="cl" colwidth="0.5*"></colspec>
    <colspec colname="c2" colwidth="1.0*"></colspec>
    <colspec colname="c3" colwidth="1.5*"></colspec>
    <colspec colname="c4" colwidth="2.0*"></colspec>
    <spanspec align="center" nameend="c4" namest="c1"></spanspec>
    spanname="hspan"/>
    <row valign="middle"><entry spanname="hspan"></entry>
    align="center">HEAD</row>
    <row valign="middle"><entry spanname="hspan"></entry>
    align="center">FOOT</row>

    <row valign="middle">
    <entry align="center">1</entry><entry></entry>
    align="center">a<entry align="center">0</entry>
    <entry align="center">0</entry>
    </row>
    <row valign="middle">
    <entry align="center">2</entry><entry></entry>
    align="center">b<entry align="center">0</entry>
    <entry align="center">0</entry>
    </row>
    <row valign="middle">
    <entry align="center">3</entry><entry></entry>
    align="center">c<entry align="center">0</entry>
    <entry align="center">0</entry>
    </row>
    <row valign="middle">
    <entry align="center">4</entry><entry></entry>
    align="center">d<entry align="center">0</entry>
    <entry align="center">0</entry>
    </row>
    <row valign="middle">
    <entry align="center">5</entry><entry></entry>
    align="center">e<entry align="center">0</entry>
    <entry align="center">0</entry>
    </row>
    <row valign="middle">
    <entry align="center">6</entry><entry></entry>
    align="center">f<entry align="center">0</entry>
    <entry align="center">0</entry>
    </row>

    </tgroup>





    Customizing using the recipe from Stayton p.474 and XEP4.18 the table is
    off center and its width drastically reduced - see attached file
    centered.jpg

    <xsl:template name="table.layout">
    <xsl:param name="table.content"></xsl:param>
    <fo:table width="100%">
    <fo:table-column column-width="proportional-column-width(1)"></fo:table-column>
    <fo:table-column></fo:table-column>
    <fo:table-column column-width="proportional-column-width(1)"></fo:table-column>
    <fo:table-body start-indent="0pt">
    <fo:table-row>
    <fo:table-cell></fo:table-cell>
    <fo:table-cell>
    <fo:table>
    <fo:table-body start-indent="0pt">
    <fo:table-row><fo:table-cell><fo:block>
    <xsl:copy-of select="$table.content"></xsl:copy-of>
    </fo:block></fo:table-cell></fo:table-row>
    </fo:table-body>
    </fo:table>
    </fo:table-cell>
    <fo:table-cell></fo:table-cell>
    </fo:table-row>
    </fo:table-body>
    </fo:table>
    </xsl:template>

    If I set the colwidths to 0.5cm instead of 0.5* etc the table is
    centered correctly. It appears that the proportional widths from FO and
    CALS are interfering with each other.

    Does anyone know a way around this problem?

    Ron
    --
    Ron Catterall Ph.D. D.Sc.
    ron@catterall.net
    http://catterall.net

    Attachment(s)

    xml
    center_test.xml   2 KB 1 version