XSL FO: how to centre tables

Subject: XSL FO: how to centre tables
From: Sebastian Rahtz <sebastian.rahtz@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx>
Date: Fri, 2 Jul 1999 13:58:20 +0000 (GMT)
I am getting confused, and wonder if anyone who knows XSL FOs could
help out. I want to specify a table, whose caption and body will be centered on
the page width. So I have done this:

<xsl:template match='table'>
 <fo:table-and-caption>
   <fo:caption>
     <fo:block text-align-last="centered">
      <xsl:text>Table </xsl:text>
          <xsl:number level="1"/><xsl:text>. </xsl:text>
      <xsl:apply-templates select="head"/>
     </fo:block>
   </fo:caption>
   <fo:table-body>
     <xsl:for-each select="row">
       <fo:table-row>
          <xsl:for-each select="cell">
           <fo:table-cell>
              <xsl:apply-templates/>
           </fo:table-cell>
          </xsl:for-each>
       </fo:table-row>
      </xsl:for-each>
   </fo:table-body>
 </fo:table-and-caption>
</xsl:template>


really simple, yes? the caption is centered, correctly, but what do I
do to make the <fo:table-body> centre itself?

Unless I mistake, a <table> must directly contain a <table-body> which 
must directly contain <table-row>s. So there is no room for a <block>
in there.

sebastian


 XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list


Current Thread