Many elements in the DocBook language support an ID attribute.
An ID is a unique name used internally to identify topics and elements
within topics. Since ID is one of DocBook's common attributes, any
element with the common attributes can support an ID attribute.
An ID is defined only once, but multiple hyperlinks and cross-references
can refer to the same ID. IDs are not seen by the user.
If you are writing help for an application, IDs are also used
by the application to identify particular topics to display when
the user requests help.
For example, you might write several topics that describe
an application's menus. The IDs that you assign to the topics are
used by the application developer. By defining identical IDs within
the application code, the developer can integrate specific topics.
This allows the application to access and display the correct topic
when help is requested for a particular menu.
Rules for ID Names |
 |
ID strings may contain letters (A
- Z and a - z), digits (0 - 9), the period (.), and the minus (-)
sign. ID strings must begin with a letter, and be unique at least
within the document in which they occur.
Case in ID strings is not significant,
but is often used to increase readability.
ID strings cannot be longer than 128 characters.
Each ID within a single help volume must be unique.
Built-in IDs |
 |
A few elements have built-in IDs, and so do not support an
author-defined ID. Each of the following elements have predefined
IDs (shown in parentheses):
To Add an ID to a DocBook Element |
 |
You include the ID string in the opening
tag of the element as follows:
Note that the value of the ID string is enclosed in quotation
marks.
All the DocBook elements with the common attributes support
an author-defined ID. These are:
In addition to including IDs with DocBook elements that support
them, you can use the Anchor element to set an ID at an arbitrary
point within a document. The Anchor can then mark a target for a
Link, which will take the Anchor's ID string for the value of its
Linkend attribute. Anchor is an inline element that may appear almost
anywhere. Anchor is an empty element, with no content.
Anchor can have ID, Pagenum, Remap, Role, and XRefLabel attributes,
but only the ID attribute is required. At the minimum, only the
Anchor start tag is present, with an ID.
When you activate a link to a location ID, the Help Viewer
displays the topic containing the ID and scrolls the window to the
ID position.
Syntax of the Anchor element
Example of the Anchor element
There is an Anchor <anchor
id="077-ch02-AN-7"> in this sentence. |