Titles and captions

If you want to add a title to a graphic, you need to wrap the graphic element in one of the formal display elements, such as figure or example. See the section “Elements for graphics” for more information.

The DocBook DTD permits a mediaobject to contain a caption element. A caption differs from a title by being longer text describing the image. It can contain paragraphs, lists, admonitions, and other text blocks. A caption does not take a title element, but if you need to supply a title you could use a formalpara which takes a title. The stylesheets process the contents of the caption element as it would any other text, and places it after the image.

If you want to customize the placement of the caption text (for example, above the image), then you would need to customize the stylesheet template that starts with <xsl:template match="mediaobject|mediaobjectco"> in the graphics.xsl file in html or fo directories of the stylesheet distribution.

If you want to customize how the caption text itself is handled, then you need to customize the template that starts with <xsl:template match="caption">. The current template (fo version shown here) is pretty simple:

<xsl:template match="caption">
  <fo:block>
    <xsl:apply-templates/>
  </fo:block>
</xsl:template>