Links and cross-references

linking and pointing cross-reference
ptr xptr ref xref

Encoding of links and cross-references using ref and xref

There are a number of textual features in which links and cross-references feature significantly, including tables of contents, errata lists, indexes, and notes. Linking may also be important for encoding atypical features such as textual segments which are printed in a place different from their intended location in the document (for instance, dramatic scenes which are printed in the front matter with an indication that they were intended to be inserted in the third act).

In P4, the TEI provides four elements for encoding linking. They are distinguished along two axes: first, as to whether they contain content or not, and second, as to whether they point inside or outside the text. The ref and xref elements may contain content, while the ptr and xptr elements must be empty. The ref and ptr elements point inside the text, while the xref and xptr elements point outside the text. In P5, the distinction between pointers inside and outside the text is eliminated, and the ref and ptr elements serve both functions. As in P4, ref contains content while ptr is an empty element.

Since most of the encoding described in this guide involves capturing linking and references that appear in the source text (e.g. cross-references or errata), the element that is most predominantly useful is the TEI ref element, which encloses a piece of content and makes explicit the link implied by that content. For instance:

<p>...see <ref target="p07">page 7</ref>...</p>

The ptr element is more useful in cases where you want to be able to generate the words of the reference (using a stylesheet), rather than encoding the wording that is already in the text; hence it is generally more useful for modern materials or materials you are authoring yourself.

In P4, the TEI does not provide a way of classifying references, but both P5 and the WWP DTD accompanying this guide provide a type attribute for these elements. The WWP offers a list of pre-defined values that reflects our areas of pointer/reference use so far: they are err and correction (for encoding errata lists), and pagenum for page references in tables of contents. Other projects should substitute a more appropriate classification that reflects your encoding of references. For many projects no classification is needed. Classifying references in this way may be useful if you want to be able to treat them differently: for instance, if you want to make some references into navigable links and have others produce a popup window. For more information see the entry on encoding errata lists.

Examples

Example 1.

<sp who="DGale.ned"><p>Toto, I have a feeling we’re not in <ref type="err" target="ec45" id="er45">Kentucky</ref> anymore.</p> </sp>
...
<div type="errata">
<head>Errata!</head>
<list type="errata">
<item> on Page 12, line 34, “we’re not in Kentucky anymore” should read "we’re not in <ref type="correction" target="er45" id="ec45">Kansas</ref> anymore" </item>
</list>...</div>