W3C home > Mailing lists > Public > www-xsl-fo@w3.org > July 2002

Re: center table horizontally (space-start)

From: G. Ken Holman <gkholman@cranesoftwrights.com>
Date: Tue, 16 Jul 2002 11:59:43 -0500
Message-Id: <>
To: "Mailing List XSL-FO (E-Mail)" <www-xsl-fo@w3.org>

At 2002-07-16 17:14 +0200, Harm Kok wrote:
>Table-and-caption does not work in fop (not supported).

Sorry ... I don't use FOP so I was unaware of the restriction.  I've tested 
and used this approach successfully on Antenna House.

>I also have encountered the same problems in FOP and did not find the 
>right solution yet.

My response was, I believe, the only elegant solution ... see the last 
paragraph of 7.15.10.

If you are dealing with a fixed width table, then there is another approach 
you could follow that is a bit cumbersome:

   <table border="solid" border-collapse="collapse" table-layout="fixed"
          start-indent="( 100% - 4cm ) div 2">
     <table-column column-width="2cm"/>
     <table-column column-width="2cm"/>
     <table-body start-indent="0pt">

... but you need to know the size of the table before-hand.  See how I take 
the difference between the entire width (100%) and the table width (4cm) 
and divide that difference by 2 to get how much belongs on the left.  The 
end-indent isn't needed because of the fixed table width.

Note that I had to "undo" the start-indent= at the table-body, otherwise 
inheritance would have applied that indent to every cell's content.

I hope this helps.

............... Ken

Upcoming: 3-days XSLT/XPath and/or 2-days XSL-FO:Sep 30-Oct 4,2002

G. Ken Holman                 mailto:gkholman@CraneSoftwrights.com
Crane Softwrights Ltd.          http://www.CraneSoftwrights.com/f/
Box 266, Kars, Ontario CANADA K0A-2E0  +1(613)489-0999 (Fax:-0995)
ISBN 0-13-065196-6                       Definitive XSLT and XPath
ISBN 1-894049-08-X   Practical Transformation Using XSLT and XPath
ISBN 1-894049-07-1                Practical Formatting Using XSLFO
XSL/XML/DSSSL/SGML/OmniMark services, books (electronic, printed),
articles, training (instructor-live,Internet-live,web/CD,licensed)
Next public training:                 2002-08-05,26,27,09-30,10-03
Received on Tuesday, 16 July 2002 13:00:26 UTC

This archive was generated by hypermail 2.3.1 : Tuesday, 6 January 2015 20:58:26 UTC