XML technologies / DocBook / Block elements / Graphics / Graphics and text alternatives

(Excerpt from "DocBook-XML: Media-neutral and platform-independent publishing" by Thomas Schraitle)

The element mediaobject allows, in addition to imageobject one or more textobject elements containing an image description. A textobject is used when no suitable image is found. There are three methods:

  1. As short text

  2. As long text

  3. As a reference to a text file.

Short text briefly describes the image. In (X)HTML, a text object using phrase generates an alternative description in the attribute alt of img (see the following example).

Example: Short-text object using phrase

<mediaobject>
  <!-- ... -->
  <textobject>
    <phrase>Ein Pinguin</phrase>
  </textobject>
<mediaobject>

Long text uses para instead of phrase for longer image descriptions. In (X)HTML, a clickable [D] for description appears in the margin. It links to a separate (X)HTML file containing all of textobject (see the following example).

Example: Long-text object using para

<mediaobject>
  <!-- ... -->
  <textobject>
    <para>Pinguine sind ...</para>
    <para>Es gibt die folgenden Arten ...</para>
  </textobject>
<mediaobject>

The third option is a reference inserted with textdata.

Example: Text object as a reference using textdata

<mediaobject>
  <!-- ... -->
  <textobject>
    <textdata fileref="pinguine.txt">
  </textobject>
<mediaobject>

The drawback of textdata is that resolving the reference requires an extension function in the XSLT processor (see "Extension functions and elements"). If your processor does not support this extension, replace textdata with XInclude:

Example: Text object as a reference using xi:include

<mediaobject xmlns:xi="http://www.w3.org/2001/XInclude">
  <!-- ... -->
  <textobject>
    <xi:include href="pinguine.txt" parse="text">
  </textobject>
<mediaobject>

Note: XInclude element in DocBook
The element xi:include is unavailable in version 4 and earlier, but can be added to the DocBookDTD (see "Adding XIncludes to DocBook 4.x"). For DocBook 5, a separate file already contains this element (see "XIncludes in DocBook 5"). For more about XIncludes, see "Including content with XIncludes".

  

back to top