Example: How the @collection-type and @linking attributes determine links

This section is non-normative.

In this scenario, a simple map establishes basic hierarchical and relationship table links. The @collection-type and @linking attributes are then added to modify how links are generated.

The following example illustrates how link relationships are defined in a DITA map:

Figure 1. Simple linking example
<topicref href="A.dita" collection-type="sequence">
  <topicref href="A1.dita"/>
  <topicref href="A2.dita"/>
</topicref>
<reltable>
  <relrow>
    <relcell><topicref href="A.dita"/></relcell>
    <relcell><topicref href="B.dita"/></relcell>
  </relrow>
</reltable>

When the content is rendered, a processor that renders these relationships as links would generate the following links based on the sample markup. Sequential next and previous links between A1 and A2 are present because of the @collection-type attribute on the parent:

Topic A
  • The topic has generated child links to A1 and A2.
  • The topic has a generated link to the related topic B.
Topic A1
  • The topic has a generated parent link to A.
  • The topic has a generated link to A2 as the next topic in a sequence.
Toipc A2A2
  • The topic has a generated parent link to A.
  • The topic has a generated link to A1 as the previous topic in a sequence.
Topic B
The topic has a generated link to the related topic B.

The following example illustrates how setting the @linking attribute can change the default behavior:

Figure 2. Linking example with the @linking attribute
<topicref href="A.dita" collection-type="sequence">
  <topicref href="B.dita" linking="none"/>
  <topicref href="A1.dita"/>
  <topicref href="A2.dita"/>
</topicref>
<reltable>
  <relrow>
    <relcell><topicref href="A.dita"/></relcell>
    <relcell linking="sourceonly"><topicref href="B.dita"/></relcell>
  </relrow>
</reltable>

When the content is rendered, a processor that renders these relationships as links would generate the following links based on the sample markup.

Topic A
  • The topic has generated child links to A1 and A2.
  • The topic does not have a generated link to B. The child link and the relationship-table link are each suppressed due to the @linking attribute.
Topic A1
  • The topic has a generated parent link to A.
  • The topic has a generated link to A2 as the next topic in a sequence.
  • The topic does not have a generated link to B as the previous topic. That link is suppressed due to the @linking attribute on the reference to B.
Topic A2
  • The topic has a generated parent link to A.
  • The topic has a generated link to A1 as the previous topic in a sequence.
Topic B
The topic has a generated link to the related topic B.