xsl-list
[Top] [All Lists]

RE: FO: center a table

2005-12-27 08:23:22
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(_at_)CraneSoftwrights(_dot_)com
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


--~------------------------------------------------------------------
XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: <mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--



<Prev in Thread] Current Thread [Next in Thread>