Hey Colin,
Your solution works perfectly... if the table in question is exactly
10cm wide :) No worries, though, because seeing that led me to some
more investigation and trial-and-error, and now I believe that I have
a solution that works for any size table, in case anyone else is
interested:
<xsl:template name="table.layout">
<xsl:param name="table.content" select="NOTANODE" />
<xsl:choose>
<xsl:when test="@tabstyle='center'">
<fo:table table-layout="fixed" width="100%">
<fo:table-column />
<fo:table-column >
<!-- Set center column width equal to table
width -->
<xsl:attribute name="column-width">
<xsl:call-template name="table.width"/>
</xsl:attribute>
</fo:table-column>
<fo:table-column />
<fo:table-body>
<fo:table-row>
<fo:table-cell column-number="2">
<xsl:copy-of select="$table.content" />
</fo:table-cell>
</fo:table-row>
</fo:table-body>
</fo:table>
</xsl:when>
<xsl:otherwise>
<xsl:copy-of select="$table.content" />
</xsl:otherwise>
</xsl:choose>
</xsl:template>
I think that with a few adjustments, it could also work for right-
aligning a table.
Ellen
On May 25, 2007, at 12:34 PM, Colin Shapiro wrote:
I should add that this wasn't with DocBook that I used this method
(I replied without realizing), so this may not help you figure out
how to customize the DocBook templates.
Colin
On 5/25/07, Colin Shapiro <[EMAIL PROTECTED]> wrote:
Hi,
The method shown on the FOP website has worked for me in the past
(using FOP, of course):
http://xmlgraphics.apache.org/fop/fo.html#fo-center-table-horizon
Colin
On 5/25/07, Ellen Juhlin < [EMAIL PROTECTED]> wrote:
Hello friendly list people,
I know this topic has come up in the past a few times, but none of
the solutions I've found seem to be working out. I'm trying to
center a table horizontally on a page. I'm using the XSL
stylesheets v.1.72, DocBook 4.4, and XEP 3.7.7.
I've tried the method listed here: http://www.renderx.net/lists/
xep-support/1444.html but it seems to create three equally-sized
columns with my table left-aligned (and overflowing) in the middle
column. I don't know if I'm "wrapping" the wrong template - I tried
calsTable, table.layout, and make.table.content, all with either
the same result, or no effect. I'm sure that I am just missing
something very minor here... can someone point me in the right
direction?
<xsl:template name="table.layout" >
<xsl:param name="table.content" select="NOTANODE" />
<xsl:choose>
<xsl:when test= "@tabstyle='center'">
<fo:table width ="100%">
<fo:table-column column-width ="proportional-
column-width(1)"/>
<fo:table-column />
<fo:table-column column-width ="proportional-
column-width(1)"/>
<fo:table-body>
<fo:table-row>
<fo:table-cell />
<fo:table-cell>
<xsl:copy-of
select="$table.content" />
</fo:table-cell>
<fo:table-cell />
</fo:table-row>
</fo:table-body>
</fo:table>
</xsl:when>
<xsl:otherwise>
<xsl:copy-of select= "$table.content" />
</xsl:otherwise>
</xsl:choose>
</xsl:template>
Please tell me what I am doing wrong!
Thanks,
Ellen
Product Specialist, LCS Series
Meyer Sound Laboratories
Product Specialist, LCS Series
Meyer Sound Laboratories