XML technologies / DocBook / Block elements / Annotations / Adding block annotations

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

The element annotation adds extensive annotations to an element. Block annotations may appear anywhere and, unlike inline annotations, can contain almost all DocBook block elements. A simple block annotation has the following structure:

Example: A simple block annotation

<annotation>    
    <title>XML-Namensraum</title>    
    <para>...</para>    
</annotation>

There are two markup methods for attaching a block annotation:

  1. The start tag <annotation> contains an attribute xml:id. The element to be annotated adds the attribute annotates. The value of annotates points to the attribute xml:id.

  2. The start tag <annotation> contains an attribute annotates. The element to be annotated needs the attribute xml:id.

In method 1, the annotation contains an anchor (see below).

Example: Anchor in the start tag annotation

<annotation xml:id="an_db">   
    <title>DocBook</title>    
    <para>DocBook 5, jetzt neu! Zu finden unter <link xlink:href="http://www.docbook.org"/></para>   
</annotation>
<!-- ... -->
<para>Für Dokumentationen wird <phrase annotations="an_db">DocBook</phrase> verwendet, das ...</para>

In method 2, the target element contains the anchor, and the annotation specifies its target (see below).

Example: Anchor in the target element’s start tag

<annotation annotates="p_db">
    <title>DocBook</title>
    <para>DocBook 5, jetzt neu! Zu finden unter <link xlink:href="http://www.docbook.org"/></para>    
</annotation>
<!-- ... -->
<para>Für Dokumentationen wird <phrase xml:id="p_db">DocBook</phrase> verwendet, das ...</para>

Both examples produce the same result. Clicking the image after the word DocBook opens the annotation (see the following figure).

Open annotation in (X)HTML

Figure: Open annotation in (X)HTML

An annotation with an anchor can be reused, which distinguishes the methods. Method 1, with an anchored annotation, is usually the most flexible.

Note: Multiple annotations
To attach multiple annotations, add the corresponding anchor values to the attribute annotates. It accepts multiple references separated by spaces:

 <phrase annotates="annot_1 annot_2">...</phrase>

  

back to top