This is the mail archive of the docbook-apps@lists.oasis-open.org mailing list .


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Putting titles below figures


Currently using the XSLT stylesheets 1.44 for Docbook the titles for all formal objects -- i.e. figures and examples -- are placed above the formal object. This is common practice for examples but not for figures. In most technical books the title goes below the figure. I know the caption goes below the figure currently, but the caption doesn't include the figure number so that's not what I really want. 

The relevant templates for formal objects are these:

<xsl:template match="figure|example">
  <xsl:call-template name="formal.object"/>
</xsl:template>

<xsl:template name="formal.object">
  <xsl:variable name="id">
    <xsl:call-template name="object.id"/>
  </xsl:variable>

  <fo:block id="{$id}"
            xsl:use-attribute-sets="formal.object.properties">
    <xsl:call-template name="formal.object.heading"/>
    <xsl:apply-templates/>
  </fo:block>
</xsl:template>

Fixing this to do what I want seemed obvious, just override these templates in my driver stylesheet and flip the order of header and body for graphics; e.g.:

<xsl:template match="figure">
  <xsl:variable name="id">
    <xsl:call-template name="object.id"/>
  </xsl:variable>

  <fo:block id="{$id}"
            xsl:use-attribute-sets="formal.object.properties">
    <xsl:apply-templates/>
    <xsl:call-template name="formal.object.heading"/>
  </fo:block>
</xsl:template>

However, it appears that the templates that get applied for the body of a figure depend on variables set by <xsl:call-template name="formal.object.heading"/> so I can't just flip the order. I tried to follow the logic of the various calls here to reproduce, but it's complicated and I got lost. :-(

The immediate question is whether anyone has a quick way to get my title s below my graphics instead of above.

The longer term question is whether this should be the default position for graphic titles? 
-- 

+-----------------------+------------------------+-------------------+
| Elliotte Rusty Harold | elharo@metalab.unc.edu | Writer/Programmer |
+-----------------------+------------------------+-------------------+ 
|          The XML Bible, 2nd Edition (Hungry Minds, 2001)           |
|              http://www.ibiblio.org/xml/books/bible2/              |
|   http://www.amazon.com/exec/obidos/ISBN=0764547607/cafeaulaitA/   |
+----------------------------------+---------------------------------+
|  Read Cafe au Lait for Java News:  http://www.cafeaulait.org/      | 
|  Read Cafe con Leche for XML News: http://www.ibiblio.org/xml/     |
+----------------------------------+---------------------------------+

----------------------------------------------------------------
To subscribe or unsubscribe from this elist use the subscription
manager: <http://lists.oasis-open.org/ob/adm.pl>


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]