[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

RE: FO: center a table

Subject: RE: FO: center a table
From: "G. Ken Holman" <gkholman@xxxxxxxxxxxxxxxxxxxx>
Date: Tue, 27 Dec 2005 10:23:22 -0500
xsl fo center table
At 2005-12-27 12:05 +0100, Florent Georges wrote:
Kaila Kaarle wrote:

> I believe you must/can have a fo:block element as the child of
> fo:flow element and then the fo:
> Set this with text-align="center" attribute for the fo:block.

  This align the text within the table, not the table on the page (more
formally on the fo:flow), doesn't it?

Yes, you are right.


The way to centre a table is to use table-and-caption and use the "centre contents in inline-progression direction" directive which happens to be named "text-align=" (don't be distracted by the name of the property, that name applies even when aligning graphic content inside of a content window).

There is an explicit paragraph in 6.7.2 that states the presence of this inheritable attribute are "placed relative to the context-rectangle...as specified by the text-align trait". That gives credence to the interpretation of "text-align" to be "centre contents in the inline-progression direction".

So, in the absence of table-and-caption, the table is not centred, but when present, the table-and-caption centres the table. I believe the XSL-FO 1.0 specification is quite explicit on this.

The instance below works just as expected in Antenna House and Ibex, though I do not get the expected results from XEP. The first test doesn't use table-and-caption, while the other two do, the first with an explicit specification of text-align= and the second with an inherited specification of text-align=. Thus, the second and third tables should be centred.

I hope this helps.

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

<?xml version="1.0" encoding="iso-8859-1"?><!--georges.fo-->
<root xmlns="http://www.w3.org/1999/XSL/Format"
      font-family="Times" font-size="20pt">

  <layout-master-set>
    <simple-page-master master-name="frame"
                        page-height="297mm" page-width="210mm"
                        margin-top="15mm" margin-bottom="15mm"
                        margin-left="15mm" margin-right="15mm">
      <region-body region-name="frame-body"/>
    </simple-page-master>
  </layout-master-set>

  <page-sequence master-reference="frame">
    <flow flow-name="frame-body" xmlns="http://www.w3.org/1999/XSL/Format">
      <block text-align="center">
        <block>Test 1</block>
        <table width="5cm" border="solid 1pt">
          <table-body>
            <table-cell>
              <block>Hello</block>
            </table-cell>
          </table-body>
        </table>
      </block>
      <block>Test 2</block>
      <table-and-caption text-align="center">
        <table width="5cm" border="solid 1pt" text-align="start">
          <table-body>
            <table-cell>
              <block>Hello</block>
            </table-cell>
          </table-body>
        </table>
      </table-and-caption>
      <block text-align="center">
        <block>Test 3</block>
        <table-and-caption>
          <table width="5cm" border="solid 1pt" text-align="start">
            <table-body>
              <table-cell>
                <block>Hello</block>
              </table-cell>
            </table-body>
          </table>
        </table-and-caption>
      </block>
    </flow>
  </page-sequence>
</root>


-- Upcoming XSLT/XSL-FO hands-on courses: Denver,CO March 13-17,2006 World-wide on-site corporate, govt. & user group XML/XSL training. G. Ken Holman mailto:gkholman@xxxxxxxxxxxxxxxxxxxx Crane Softwrights Ltd. http://www.CraneSoftwrights.com/s/ Box 266, Kars, Ontario CANADA K0A-2E0 +1(613)489-0999 (F:-0995) Male Cancer Awareness Aug'05 http://www.CraneSoftwrights.com/s/bc Legal business disclaimers: http://www.CraneSoftwrights.com/legal

Current Thread

PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.