This is the mail archive of the
docbook-apps@lists.oasis-open.org
mailing list .
Re: [docbook-apps] table title horizontal alignment, center
- From: "Bob Stayton" <bobs at sagehill dot net>
- To: <swhitlat at getnet dot net>, <docbook-apps at lists dot oasis-open dot org>
- Date: Wed, 17 Mar 2004 18:14:41 -0800
- Subject: Re: [docbook-apps] table title horizontal alignment, center
- References: <200403171837.46386.swhitlat@getnet.net>
I think you will need to customize the template named formal.object.heading
in fo/formal.xsl. Something like this:
<xsl:template name="formal.object.heading">
<xsl:param name="object" select="."/>
<xsl:param name="placement" select="'before'"/>
<fo:block xsl:use-attribute-sets="formal.title.properties">
<!-- ADD THE FOLLOWING THREE LINES -->
<xsl:if test="self::table">
<xsl:attribute name="text-align">center</xsl:attribute>
</xsl:if>
<xsl:choose>
<xsl:when test="$placement = 'before'">
<xsl:attribute
name="keep-with-next.within-column">always</xsl:attribute>
</xsl:when>
<xsl:otherwise>
<xsl:attribute
name="keep-with-previous.within-column">always</xsl:attribute>
</xsl:otherwise>
</xsl:choose>
<xsl:apply-templates select="$object" mode="object.title.markup">
<xsl:with-param name="allow-anchors" select="1"/>
</xsl:apply-templates>
</fo:block>
</xsl:template>
It checks to see if the formal object is a table, and if so adds the
text-align attribute. I presume you only wanted to do this with tables, not
figures, examples, etc.
Bob Stayton
Sagehill Enterprises
DocBook Consulting
bobs@sagehill.net
----- Original Message -----
From: "Steve Whitlatch" <swhitlat@getnet.net>
To: <docbook-apps@lists.oasis-open.org>
Sent: Wednesday, March 17, 2004 5:37 PM
Subject: [docbook-apps] table title horizontal alignment, center
> Hello,
>
> I am experimenting with techniques for horizontally aligning table
> titles. I have some XSL code that center aligns the table title text,
> but it fails to center align the prefix and autonumber.
>
> Here is the code from my XSL customization layer:
>
> <xsl:template match="table" mode="insert.title.markup">
> <xsl:param name="title"/>
> <fo:block text-align="center"
> <xsl:value-of select="$title"/>
> </fo:block>
> </xsl:template>
>
>
> Here is an ascii art depiction of what I get:
>
> * table row *
> ******************************************
> * last row of table *
> ******************************************
> Table 1
> Table Title
>
> The text from <title>Table Title</title> is centered and moved down
> vertically about one line. And the "Table 1" portion is unaffected. I
> guess I should not be expecting anything else with that code though.
> Seems obvious. I'd like to keep both parts together and also prevent
> the entire displayed table title from moving down.
>
> Looks like I need something like:
> <xsl:value-of select="$title-plus-prefix-plus-autonumber"/>
>
> But it won't be that easy. Any suggestions?
>
> The answer to this question, and examples of applied solutions to all
> other questions I've asked on this list will be made available in a
> downloadable example DocBook XML document/project from my homepage.
> I'm trying to remove the worst errors/deficiencies before posting it.
>
> I've also got a round-trippable structured FrameMaker 7.0 version of
> the same document I made for comparison. I'll post both projects
> within a week or so.
>
> Thanks to Bob Stayton for all his patient help.
>
> Steve Whitlatch
>
>
> To unsubscribe from this list, send a post to
docbook-apps-unsubscribe@lists.oasis-open.org, or visit
http://www.oasis-open.org/mlmanage/.
>
>
>
To unsubscribe from this list, send a post to docbook-apps-unsubscribe@lists.oasis-open.org, or visit http://www.oasis-open.org/mlmanage/.