In DITA, the uniqueness of ID attributes within a specific scope is essential for making references.
According to XML standard, ID attributes are declared as attributes with type ID in a Schema or DTD. In this case, Schema validation provides the uniqueness of ID values within the scope of the whole document.
Topic elements
Topic elements include topic, concept, task, and other specialized topics.
The ID attribute of a topic element must be unique within the scope of the whole document. This is reflected in the format of references to topic elements as illustrated below:
href="document.xml#concept"
href="document.xml#concept-1"
IDs of topic elements are declared as attributes with type ID in a Schema or DTD.
Non-topic elements
Schema validation of IDs can't be applied to all types of elements. Schema validates IDs of DITA topic elements only, while IDs of DITA non-topic elements are validated another way.
Non-topic elements are child elements of topic elements.
DITA ID is the ID attribute of a non-topic element.
DITA IDs of non-topic elements must be unique within the following scopes:
In topic-based documents
In a topic-based document, the DITA ID of a non-topic element must be unique within the scope of its parent topic.
In map-based documents
In a map-based document, the DITA ID of a non-topic element must be unique within the scope of its parent map.
Thus, DITA ID must be unique within the scope of its nearest parent topic or map. This is reflected in the format of references to non-topic elements as illustrated below:
href="document.xml#concept/legal-notice"
href="document.xml#task/legal-notice"
The uniqueness of DITA IDs of non-topic elements within the scope of the parent topic or map can't be provided by means of Schema and DITA IDs are specially treated in Serna. For the maintenance and validation of DITA ID uniqueness, the rules are specified in Serna document template files.
When you work with DITA documents, Serna maintains the uniqueness of DITA elements' IDs and reports duplicate DITA IDs.