Using keys for addressing

For topic references, image references, and other link relationships, resources can be indirectly addressed by using the @keyref attribute. For content reference relationships, resources can be indirectly addressed by using the @conkeyref attribute.

Syntax

For references to topics, maps, and non-DITA resources, the value of the @keyref attribute is simply a key name (for example, keyref="topic-key").

For references to non-topic elements within topics, the value of the @keyref attribute is a key name, a slash ("/"), and the ID of the target element (for example, keyref="topic-key/some-element-id".)

Example

For example, consider this topic in the document file.dita:

<topic id="topicid">
 <title>Example referenced topic</title>
 <body>
  <section id="section-01">Some content.</section>
 </body>
</topic>
and this key definition:
<map>
  <topicref keys="myexample"
    href="file.dita"
  />
</map>

A cross reference of the form keyref="myexample/section-01" resolves to the <section> element in the topic. The key reference is equivalent to the URI reference xref="file.dita#topicid/section-01".

Was this helpful?