Next in thread → Next in month →

Re: [docbook-apps] How do I move a figure title to display below a graphic

From
Bob Stayton <>
Date
2004-09-08T17:14:41+00:00
ID
021801c495c7$4e40b2f0$6401a8c0@toshiro
Thread
Re: [docbook-apps] How do I move a figure title to display below a graphic
Funny, I just made this customization myself.  Perhaps it should be a
parameter.  8^)

First, change the 'formal.title.placement' parameter for figure as described
in:

http://www.sagehill.net/docbookxsl/FormalTitles.html#FormalTitleLocation

To put the caption below the title, though, you need to customize the
match="mediabobject" template and the name="formal.object.heading" template.
That's because the mediaobject template currently handles the caption, since
caption is part of its content.  Since figure is a wrapper around
mediaobject, you have to tell mediaobject to not output the caption so that
formal.object.heading can place it after the title.  That means changing the
caption line in the mediaobject template:

  <xsl:if test="not(parent::figure)">
    <xsl:apply-templates select="caption"/>
  </xsl:if>

At the end of the template named 'formal.object.heading', add:

  <!-- Add mediaobject caption below title -->
  <xsl:if test="self::figure/mediaobject/caption">
    <xsl:apply-templates select="mediaobject/caption"/>
  </xsl:if>

And then add a template to handle caption:

<xsl:template match="caption">
  <fo:block keep-with-previous.within-column="always">
    <xsl:apply-templates/>
  </fo:block>
</xsl:template>

Of course, if you are using FOP the keep won't work ...
If you want this repositioning to also apply to tables, examples, etc, then
don't make it dependent on figure as I have done here.

Bob Stayton
Sagehill Enterprises
DocBook Consulting



----- Original Message ----- 
From: "Cassafrass" <>
To: <>
Sent: Tuesday, September 07, 2004 12:59 PM
Subject: [docbook-apps] How do I move a figure title to display below a
graphic


> I was hoping that someone might have solved this problem already. I
> would like to have the title, including the automatically generated
> "Figure 1"  for my image display below the image, but above the
> caption.  Do I have to modify fo/docbook.xsl or is there another file?
> I tried moving <title></title>  into the mediaobject, but that just
> confuses FOP (quite badly).
>
> <figure>
> <title>Regional Model Visualized with OpenDX</title>
> <mediaobject id="RegModel">
> <imageobject role="fo">
> <imagedata fileref="graphics/simpletest.eps" scale="125" format="EPS"/>
>  </imageobject>
> <caption>
> <para>A snapshot of a scientific model. </para>
> </caption>
> </mediaobject>
> </figure>
>
> which produces
>
> Figure 1. Regional Model Visualized with OpenDX
> [image]
> A snapshot of a scientific model.
>
> I'd like it to look like
>
> [image]
> Figure 1. Regional Model Visualized with OpenDX.
> A snapshot of a scientific model.
>
> Thanks, Cassie
>
>
Next in thread → Next in month →