Relationship Table (reltable)

Relationship Tables externalize links and decouple topics from each other, because the topics themselves do not contain links to other topics, that could break, if the target topics are missing.

Sample project: reltable.zip

map.ditamap

The map.ditamap references the reltable.ditamap, that contains the relationship table. Relationship tables can only be defined in maps, not in topics.

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE map PUBLIC "-//OASIS//DTD DITA Map//EN" "map.dtd">
<map>
  <title>Relationship Table Example</title>
  <topicref href="batsonar.dita" keys="batsonar"/>
  <topicref href="batcaring.dita" keys="batcaring"/>
  <topicref href="batfeeding.dita" keys="batfeeding"/>
  <topicref href="batguano.dita" keys="batguano"/>
  <topicref href="bathistory.dita" keys="bathistory"/>
  <!-- The reltable.ditamap only contains a relationship table -->
  <mapref href="reltable.ditamap"/>
</map>

reltable.ditamap

The reltable.ditamap contains the relationship table. The keys are propagated from the map.ditamap.

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE map PUBLIC "-//OASIS//DTD DITA Map//EN" "map.dtd">
<map>
    <title>Relationship Table</title>
    <reltable>
        <relheader>
            <relcolspec type="concept"/>
            <relcolspec type="task"/>
            <relcolspec type="reference"/>
        </relheader>
        <relrow>
            <relcell>
                <topicref keyref="batsonar"/>
            </relcell>
            <relcell>
                <topicref keyref="batcaring"/>
                <topicref keyref="batfeeding"/>
            </relcell>
            <relcell>
                <topicref keyref="batguano"/>
                <topicref keyref="bathistory"/>
            </relcell>
        </relrow>
    </reltable>
</map>

Result

In the output, the following links are rendered.

  • batsonar links to batcaring, batfeeding, batguano, bathistory
  • batcaring links to batsonar, batguano, bathistory
  • batfeeding links to batsonar, batguano, bathistory
  • batguano links to batsonar, batcaring, batfeeding
  • bathistory links to batsonar, batcaring, batfeeding