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

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 linkage is 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 output is generated, the topics contain the following linkage. Sequential (next/previous) links between A1 and A2 are present because of the @collection-type attribute on the parent:

A
Links to A1, A2 as children
Links to B as related
A1
Links to A as a parent
Links to A2 as next in the sequence
A2
Links to A as a parent
Links to A1 as previous in the sequence
B
Links to A as related

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 output is generated, the topics contain the following linkage:

A
Links to A1, A2 as children
Does not link to B as a child or related topic
A1
Links to A as a parent
Links to A2 as next in the sequence
Does not link to B as previous in the sequence
A2
Links to A as a parent
Links to A1 as previous in the sequence
B
Links to A as a related topic