ID values in XML elements

Specifying ID values in XML markup

In an ebook format (PDF, EPUB or web pages) you navigate through the book components and sections (e.g. subheadings of chapters) using hyperlinks. To enable hyperlinking from one part of a document to another, it is recommended that you add identification names (or ID values) to the elements so that you can specify the names of hyperlink targets. When adding or editing markup, add ID values to the elements as attributes. These ID values allow you to specify the target of hyperlinks, so that in an ebook a user can click on a hyperlink in any part of the text and be taken to the target.

Specify the ID values with the attribute xml:id. This markup can be added to any element in a book. When you add an xml:id attribute to an element, use a relevant name for the value so that it is easy to add links to that part of the book. For example, for the first section in chapter 1, you could use an xml:id value of "sec1.1"—so you can remember it as "chapter 1, section 1" if you need to hyperlink to that later in the book. Another example is to add an ID value of "fig1" to the <figure> element of Figure 1 so that you can hyperlink from the body text to the figure.

Have a look through the XML book templates in the directory /xml and see how xml:id values are specified for different elements.

Note: If you do not need to hyperlink from one part of a book to another, then you do not need to specify xml:id values.