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]
Other format: [Raw text]

Re: [docbook-apps] image & caption alignment problem


Hi Tristan,

Since the align attribute is supported on caption in the DTD, it should be
supported in the stylesheet as well.  Could you file a bug report on
SourceForge for this?

In the meantime, you could use a customization such as this:

<xsl:template match="caption">
  <fo:block>
    <xsl:attribute name="text-align">
      <xsl:choose>
        <xsl:when test="@align != ''">
          <xsl:value-of select="@align"/>
        </xsl:when>
        <xsl:otherwise>left</xsl:otherwise>
      </xsl:choose>
    </xsl:attribute>
    <xsl:apply-templates/>
  </fo:block>
</xsl:template>

The align attribute on caption is a bit of a muddle.  Before HTML table
markup was added in 4.3, the caption element did not have an align
attribute.  It was added because HTML tables permit a caption element, and
that attribute came along.  Since the same element name was already used for
mediaobject, it got the new attribute too.  The attribute only allows values
of top, bottom, left, and right.  Note that there is no center, since that
is the default for captions in HTML tables. Note also that you can't specify
something like top (above the table) and left at the same time.  Perhaps we
should have adopted the Strict XHTML table model, which does not have an
align attribute on caption.  8^)

Bob Stayton
Sagehill Enterprises
DocBook Consulting
bobs@sagehill.net


----- Original Message ----- 
From: "Tristan Fiedler" <fiedler@cshl.edu>
To: "Docbook-Apps" <docbook-apps@lists.oasis-open.org>
Sent: Tuesday, February 08, 2005 1:51 PM
Subject: [docbook-apps] image & caption alignment problem


> Hi All,
>
> When using :
>
> <mediaobject id="figure1" xreflabel="Figure1">
> <imageobject>
> <imagedata entityref="fig1" width="60%" align="center"/>
> </imageobject>
> &fig1legend;
> </mediaobject>
>
> where fig1legend is :
>
> <caption>
>   <formalpara>
>       <title>Figure 1. Types of splicing.</title>
>       <para>Legend text goes here  </para>
>   </formalpara>
> </caption>
>
> The caption text is also being "centered" presumably by the align
> attribute in the imagedata element. I have tried <caption align="left">
> with no success.
>
> How can one center the image, but left justify the caption?
>
> Cheers,        Tristan
> ------------------------------
> Tristan J. Fiedler
> Cold Spring Harbor Laboratory
>
>
>



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