Skip to content

CTS URNs: Using the xml:base attribute in CTS divs

Lisa Cerrato edited this page May 27, 2021 · 1 revision

The @xml:base attribute provides a base URI reference with which applications can resolve relative URI references into absolute URI references.

According to The Canonical Text Services URN specification

The Canonical Text Services URN (CTS URN) scheme defined here closely follows the syntactic requirements of a URN, but extends its goal to provide a system of persistent, technology-independent identifiers for texts and passages of texts.

One of the advantages of a CTS URN is that it offers a unique persistent identifier enabling precise citations down to the level of letter or characters, if desired. Most commonly, the passage citation is a span of text or a word.

For example, urn:cts:greekLit:tlg0016.tlg001.perseus-grc2:2.5.1 identifies book 2, chapter 5, section 1 of the Perseus-published Greek edition of The Histories of Herodotus, as illustrated in the Scaife Viewer and via the CTS Get Passage API.

To cite the word ναυτίλλονται in this passage, one could construct the URN as: urn:cts:greekLit:tlg0016.tlg001.perseus-grc2:2.5.1@ναυτίλλονται

More examples may be found at the specification linked above.


The above passage as represented in EpiDoc and CTS compliant XML is nested, so that the container for the passage is introduced by the <div>: <div type="textpart" subtype="section" n="1">. The book and chapter for this section 1, are determined by the remaining XML file structure in context. It is section 1, relative to chapter 5, which itself is relative to book 2.

In other words, there are multiple <div>s in this file identical to <div type="textpart" subtype="section" n="1"> — we only know which "section 1" this is because of its relative position in the file markup hierarchy.

However, what if we added a better description to this section 1, so that we would know its position in the markup? What if instead of a relative reference, we could construct an absolute reference in this particular <div>?

In order to provide better machine readable materials, we would ideally provide all of the information necessary to reconstruct the full CTS URN in this division. So: <div type="textpart" subtype="section" n="1"> might become <div type="textpart" subtype="section" n="urn:cts:greekLit:tlg0016.tlg001.perseus-grc2:2.5.1">.

This is not permissible in the XML, however, due to restrictions on the @n attribute. So an alternative construction would be to use @xml:base and write:

<div type="textpart" xml:base="urn:cts:greekLit:tlg0016.tlg001.perseus-grc2:2.5" subtype="section" n="1">

Here we can computationally reconstruct the full URN: we know that section 1, has the antecedents of containers named "2" and "5" in urn:cts:greekLit:tlg0016.tlg001.perseus-grc2 (note that the references declaration in the file header will tell you what "2" and "5" represent).