URI-based (direct) addressing
URI references address resources and (in some cases) subcomponents of those resources. In this context, a resource is a DITA document (map, topic, or DITA base document) or a non-DITA resource (for example, an image, a Web page, or a PDF document).
URI references that are URLs must conform to the rules for URLs and URIs. Windows paths that contain a backslash (\) are not valid URLs.
URIs and fragment identifiers
For DITA resources, fragment identifiers can be used with the URI to address individual
elements. The fragment identifier is the part of the URI that starts with a number
#topicid/elementid. URI references also can include a query
component that is introduced with a question mark (?). DITA processors MAY ignore queries on URI references to
DITA resources. URI references that address components in the same
document MAY consist of just the
For addressing DITA elements within maps and topics or individual topics within documents containing multiple topics, URI references must include the appropriate DITA-defined fragment identifier. URI references can be relative or absolute. A relative URI reference can consist of just a fragment identifier. Such a reference is a reference to the document that contains the reference.
Addressing non-DITA targets using a URI
DITA can use URI references to directly address non-DITA resources. Any fragment identifier used must conform to the fragment identifier requirements that are defined for the target media type or provided by processors.
Addressing elements within maps using a URI
When addressing elements within maps, URI references can include a fragment identifier
includes the ID of the map element, for example,
#mapId. The same-topic, URI-reference fragment identifier of a period
(.) can not be used in URI references to elements within
Addressing topics using a URI
When addressing a DITA topic element, URI references can
include a fragment identifier that includes the ID of the topic element
#topicId). When addressing
the DITA topic element that contains the URI reference, the URI reference might include the same topic fragment identifier of "."
Topics always can be addressed by a URI reference whose fragment identifier consists of the topic ID. For the purposes of linking, a reference to a topic-containing document addresses the first topic within that document in document order. For the purposes of rendering, a reference to a topic-containing document addresses the root element of the document.
Consider the following examples:
- Given a document whose root element is a topic, a URI reference (with no fragment identifier) that addresses that document implicitly references the topic element.
- Given a <dita> document that contains multiple topics, for the purposes of linking, a URI reference that addresses the <dita> document implicitly references the first child topic.
- Given a <dita> document that contains multiple topics, for the purposes of rendering, a URI reference that addresses the <dita> document implicitly references all the topics that are contained by the <dita> element. This means that all the topics that are contained by the<dita> element are rendered in the result.
Addressing non-topic elements using a URI
When addressing a non-topic element within a DITA topic, a URI reference must use
fragment identifier that contains the ID of the ancestor topic element of the non-topic
element being referenced, a slash ("/"), and the ID of the
non-topic element (
#topicId/elementId). When addressing a non-topic element within the topic that contains the URI reference,
URI reference can use an abbreviated fragment-identifier syntax that replaces the
with "." (
This addressing model makes it possible to reliably address elements that have values for the @id attribute that are unique within a single DITA topic, but which might not be unique within a larger XML document that contains multiple DITA topics.
Examples: URI reference syntax
The following table shows the URI syntax for common use cases.
|Use case||Sample syntax|
|Reference a table in a topic at a network location||
|Reference a section in a topic on a local file system||
|Reference a figure contained in the same XML document||
|Reference a figure contained in the same topic of an XML document||
|Reference an element within a map||
|Reference a map element within the same map document||
|Reference an external Web site||
|Reference an element within a local map||
|Reference a local map||
|Reference a local topic|| Reference a local topic
|Reference a specific topic in a local document||
|Reference a specific topic in the same file||
|Reference the same topic in the same XML document||
|Reference a peer map for cross-deliverable linking||