XML technologies / DocBook / Structural elements / Common attributes

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

DocBook provides attributes available on every element, listed below. They are usually optional, though some are required on certain elements.

These attributes provide additional information such as language, audience, security, or difficulty level. They distinguish elements with the same name, which can help when filtering sections by difficulty or listing all English quotations in a document.

Common attributes for all DocBook 4 and 5 elements

arch (Architecture)

specifies an element’s chip or computer architecture, such as i386, x86_64 and so on.

audience (Audience)

specifies the intended audience, such as programmers, system administrators, or beginners.

condition (Condition)

introduced in version 4.0 as a general-purpose attribute containing application-specific conditions.

conformance (Conformance)

identifies a standard, such as ISO, IETF, or DIN, to which the element conforms; not used very often.

dir (Writing direction)

marks the writing direction, which can be overridden. Available since DocBook V4.3. Rarely needed, it is used only if the publishing system cannot determine the writing direction from the Unicode character itself.

id (Anchor, marker, identifier)

marks an element so that it can be referenced. Available only in DocBook 4 and earlier. In DocBook 5, replace id with xml:id. Most elements do not require this attribute, but a few do.

Note: Permitted characters in an attribute value
Although XML places few restrictions on permitted characters, limit yourself to letters (a-z, A-Z), digits, underscores, and periods. The DocBook XSLT stylesheets can generate (X)HTML chunk files from the id attribute value. Some XSLT tools have problems generating these files if they contain umlauts.

lang (Language)

identifies the language code, such as de for German, en for English, and so on. In combined language-country codes, the hyphen is automatically converted to an underscore; thus, de-DE becomes de_DE. For more codes, see ISO 639 and ISO 639-2: The Code Lists. This attribute is available only in DocBook 4 and earlier. In DocBook 5, replace lang with xml:lang.
If no language is specified, English is normally the default, though this can depend on the applications used. The DocBook XSL stylesheets currently recognize all common languages.

linkend/ linkends (DocBook 5 only) (internal link target)

points to an anchor identified by the attribute id. Compared with linkend the attribute linkends (plural!) can contain one or more anchors separated by whitespace. The attribute linkends is not available on every element.

os (Operating system)

identifies the operating system to which the element applies, distinguishing text written for Linux, Macintosh, Windows, and so on.

remap (Remapping)

contains the name of a semantically similar element from another markup language or an earlier DocBook version. This may help when converting XML formats while retaining the original element information. It is rarely needed for text written from scratch.

revision (Revision number)

specifies a revision number.

revisionflag (Revision status)

identifies an element’s revision status, such as added, deleted, changed, or disabled. Use revisionflag to show changes between versions. This attribute is usually set by XML comparison tools rather than manually. It has no default value.

role (Role)

classifies the element. Stylesheets or custom programs can use it to vary behavior, for example between print and online editions.

security (Security level)

identifies data belonging to a particular security level

userlevel (Difficulty level)

specifies the minimum experience level required of the user

vendor (Vendor)

identifies vendor-specific data

xreflabel (Cross-reference name)

text inserted when an xref references it

wordsize (Word size)

specifies the computer architecture’s word size, or width in bits. Available since DocBook V4.4.

xml:base (Base URI)

specifies the base URI of the element and its children. Available since DocBook V4.3 and needed when processing XIncludes, which may insert it automatically.

DocBook 5 supports some attributes from the XLink specification:

Attributes for DocBook 5 only

annotations (Annotations)

identifies one or more annotations. For details, see “Adding block annotations”.

xml:lang (Language)

this DocBook 5 attribute has the same meaning as lang (see the attribute lang).

xml:id (Anchor, marker, identifier)

this frequently used DocBook 5 attribute has the same meaning as id (see the attribute id).

xlink:actuate (Actuation)

specifies when to display the link: on loading (onLoad), on request (onRequest), never (none), or otherwise (other). Mainly needed for special requirements.

xlink:arcrole (Role for arc elements)

has the same semantics as xlink:role. Compared with xlink:role the attribute xlink:arcrole describes arc elements. In XLink, paths between resources are calledarcs and are represented by arc elements. An arc element contains, in the attribute xlink:arcrole, an absolute URI identifying the relationship between arc elements. Rarely needed.

xlink:href (Link target)

points to the URI to reference

xlink:role (XLink role)

uses a URI to describe the relationship between links. The URI describes or explains the link.

xlink:show (Display)

specifies how to open the link: in a new window (new), replacing the old one (replace), embedded (embed), or otherwise (other).

Note that some values make no sense for certain output media.

xlink:title (Link type)

describes the link. This may be useful if the target medium can display it as a popup or in another way. (X)HTML uses this description

xlink:type (simple)

specifies the link type; DocBook 5 currently allows only simple. A simple link creates a unidirectional reference from the element to a URI. This is similar to an HTML link. The attribute usually need not be specified.

 

  

back to top