OASIS Mailing List ArchivesView the OASIS mailing list archive below
or browse/search using MarkMail.

 


Help: OASIS Mailing Lists Help | MarkMail Help

docbook-apps message

[Date Prev] | [Thread Prev] | [Thread Next] | [Date Next] -- [Date Index] | [Thread Index] | [List Home]


Subject: Centering Tables in Print with Fop 1.0


I have no problems now for tables spanning the print width, nor with
tables of any width in html.  But I need to center
less-than-page-width tables in print.

I have used Bob Stayton's xsl fo chunk on p. 474 as a start to try to
get my narrow tables centered in print.  Here is my current version:

<!-- center tables in print, from p. 474 in Stayton: -->
<xsl:template name="table.layout">
  <xsl:param name="table.content"/>
  <fo:table width="100%" table-layout="fixed"><!-- I dded table-layout
attribute -->

    <fo:table-column column-width="proportional-column-width(1)"/>
    <!-  [1] hack next line: added actual table width here -->
    <fo:table-column column-width="3in"/>
    <fo:table-column column-width="proportional-column-width(1)"/>
    <fo:table-body start-indent="0pt">
      <fo:table-row>

        <!-- <fo:table-cell/> -->
        <!-- [2] fo complains about missing table-cell children, I
added Bob's zero space char from p. 261 -->
        <fo:table-cell><fo:block>&#xFEFF;</fo:block></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"/>
               </fo:block></fo:table-cell></fo:table-row>
            </fo:table-body>
          </fo:table>

        </fo:table-cell>

        <!-- ditto from [2] -->
        <fo:table-cell><fo:block>&#xFEFF;</fo:block></fo:table-cell>

      </fo:table-row>
    </fo:table-body>
  </fo:table>
</xsl:template>

That works for the one specific table when I hardwire the actual table
width.  Is there any xsl:fo magic that can get the total original
table width at [1]?  If not I suppose I can post process the fo to fix
it, but there  must be a more elegant way.

Thanks,

-Tom

Thomas M. Browder, Jr.
Niceville, Florida
USA


[Date Prev] | [Thread Prev] | [Thread Next] | [Date Next] -- [Date Index] | [Thread Index] | [List Home]