The Crash Course to DocBook

Chapter 9. Links

These are the tags covered in this section:

anchor - Spot in text
email - Email address in an address
link - Hypertext link
ulink - A link that addresses its target by means of a URL, a Uniform Resource Locator

Linking in DocBook is very similar to linking in HTML. The <link> tag is used to link to any element with an ID in a document, and can also be used to link to other local files as well. The <ulink> tag is used when you need to link to a URL. The <email> tag is a specialized form of the ulink tag used for email addresses. <anchor> is used to mark a spot in the text that you want to reference later with a Link.

Example 9-1. Many kinds of links


<para id="mylink">
This is a paragraph that will be linked to with a link tag. Oh, and by
the way, check out <ulink url="http://www.kde.org">my favorite web
site</ulink> while you are here. <anchor id="anotherlink"/> Kilroy was
here.</para>
<para>
The above paragraph can be located <link linkend="mylink">here</link>.
My email address is <email>konqui@kde.org</email></para>

Note that Link uses the linkend attribute and ulink uses the URL attribute for their link targets. The above example would be displayed something like this when converted:

This is a paragraph that will be linked to with a link tag. Oh, and by the way, check out my favorite web site while you are here. Kilroy was here.

The above paragraph can be located here. My email address is