xsl-list
[Top] [All Lists]

RE: FO: center a table

2005-12-27 09:50:26
"G. Ken Holman" wrote:

  [ I let the complete quotation, to can easily forward it
    to the FOP ML.  Response below. ]

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.

<?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>

  Thanks for this interesting explanatin, and for the
example.  Unfortunately, FOP 0.91 beta, the FO processor I
use, seems to not support 'fo:table-and-caption'.  Below the
output from FOP (stable, alpha and beta).  The PDF output is
available at:

    http://www.fgeorges.org/tmp/center-table-0.90.pdf
    http://www.fgeorges.org/tmp/center-table-0.91.pdf

  Diagnostics:

    ~/drafts/fo> fop-0.20.5 center-table.fo center-table.pdf 
    [INFO] Using org.apache.xerces.parsers.SAXParser as SAX2 Parser
    [INFO] Using org.apache.xerces.parsers.SAXParser as SAX2 Parser
    [INFO] FOP 0.20.5
    [INFO] Using org.apache.xerces.parsers.SAXParser as SAX2 Parser
    [INFO] building formatting object tree
    [INFO] setting up fonts
    [ERROR] file:/x:/eclipse3_workspace/drkm/fo/center-table.fo:19:25
      A table cell must be child of fo:table-row, not
      fo:table-body

    ~/drafts/fo> fop-0.90 center-table.fo center-table.pdf 
    Initializing User Agent Configuration
    Warning(17/47): fo:table, The collapsing border model on
      an fo:table is currently not supported by FOP
    Warning(17/47): fo:table, table-layout="auto" is
      currently not supported by FOP
    fo:table-and-caption is not yet implemented.
    Warning(27/66): fo:table, The collapsing border model on
      an fo:table is currently not supported by FOP
    Warning(27/66): fo:table, table-layout="auto" is
      currently not supported by FOP
    Warning(38/68): fo:table, The collapsing border model on
      an fo:table is currently not supported by FOP
    Warning(38/68): fo:table, table-layout="auto" is
      currently not supported by FOP
    No LayoutManager maker for class class
      org.apache.fop.fo.flow.TableAndCaption
    No LayoutManager maker for class class
      org.apache.fop.fo.flow.TableAndCaption

    ~/drafts/fo> fop-0.91 center-table.fo center-table.pdf 
    Warning(17/47): fo:table, table-layout="auto" is
      currently not supported by FOP
    fo:table-and-caption is not yet implemented.
    Warning(27/66): fo:table, table-layout="auto" is
      currently not supported by FOP
    Warning(38/68): fo:table, table-layout="auto" is
      currently not supported by FOP
    No LayoutManager maker for class class
      org.apache.fop.fo.flow.TableAndCaption
    No LayoutManager maker for class class
      org.apache.fop.fo.flow.TableAndCaption

    ~/drafts/fo> 

  I forward this email to the FOP ML.  Thanks for your help.

  Regards,

--drkm




















        

        
                
___________________________________________________________________________ 
Nouveau : téléphonez moins cher avec Yahoo! Messenger ! Découvez les tarifs 
exceptionnels pour appeler la France et l'international.
Téléchargez sur http://fr.messenger.yahoo.com

--~------------------------------------------------------------------
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>