DITA maps and their usage

New topic cluster to hold normative architectural content about DITA maps. Currently holds notes about material that we intend to cover in the new topic cluster.

  • How <topicref> elements establish hierarchies including parent/child relationships and next/previous relationships.
  • Map-group elements
    • Role as convenience elements—in most (all?) cases, the same function can be accomplished with base elements. For example, <topichead> is effectively no different than <topicref> with nothing but a title.
    • Special role of <topicgroup>, which does not contribute to hierarchy
  • How relationship tables establish linking relationships between topic references
  • Meaning of titles (and navigation titles) on maps, submaps, mapgroup elements, and relationship tables
  • Link relationships created by attributes and nesting in DITA maps
Topic Applicable content
3.4.5.1 Example: DITA map that references a subordinate map Resolution of a submap.
3.4.5.2 Example: DITA map with a simple relationship table How links are generated from a relationship table; how processors might represent a relationship table.
3.4.5.3 Example: How the @collection-type and @linking determine links Effect of @collection-type and @linking attributes on generated links.
6.1 Navigation Container topic; incorporate into new "DITA maps and their usage" cluster.
6.1.1 Table of contents All content is applicable and needs to be incorporated into the new "DITA maps and their usage" cluster – Closest thing we currently have to a topic about how maps create hierarchies.
9.3.1.1 <map> Relationships between topics created by map hierarchy or @collection-type attribute; role of titles, especially in submaps.
9.3.1.2 <topicref> Role of <topicref> nesting in creating containment hierarchies and parent-child relationships.
9.3.1.6 <reltable> Relationship table titles – Processing expectations for relationship tables (not rendered, used to generate links) – Within a map tree, the effective relationship table is the union of all relationship tables in the map. – How a DITA-aware tool might represent the <reltable> element graphically.
9.3.1.10 <relcolspec> How labels for related links from a relationship table are generated.
9.3.2.3 <mapref> The hierarchy of the referenced map is merged into the container map at the position of the reference, and the relationship tables of the child map are added to the parent map.
9.3.2.4 <topicgroup> How processors handle navigation titles within <topicgroup> elements.
9.8.13.10 The @format attribute How processors determine the value of the @format attribute when it is not explicitly set.
  • DITA maps
  • Relationship tables
  • Creating navigational hierarchies
  • Defining links between resources

When specialized <topicref> elements reference a map, they might imply a semantic role for the referenced content. The @impose-role attribute provides a mechanism to declare that such references impose their original role on referenced content.

In many cases the <topicref> element is specialized in order to create a specific role for the reference. For example, the <keydef> element creates a new role for the reference, but does not create a role for the target of the reference. In other cases, the element is specialized to create a role for the target of the reference. For example, in the Bookmap specialization from the DITA Technical Communication specializations, the <chapter> element creates a role for the target of the reference: it declares that the referenced content is a chapter in the context of this map.

The declaration of roles can be harder to follow when the target of a reference is a map or branch of a map. In such cases, a <topicref> element can reference a map, which in turn references content. When resolving those references, processors need to know which roles created by the <topicref> elements need to be preserved for the content.

For example, assume a <setupProject> element that is specialized from <topicref> indicates that the referenced content plays the "setup a project" role in a publication. This might result in special formatting or generated headings when the content is rendered. If that element refers to a map instead of a topic, that specialized role still needs to be passed on to topics in the referenced map - regardless of what <topicref> elements might be used in that referenced map.

The @impose-role attribute provides a way for specialized elements to declare whether processors should use this behavior. This attribute is only evaluated when a <topicref> element refers to a map or branch of a map. In that case, it indicates whether the element provides a role for content that should be passed on to content in the referenced map.

The role created by a <topicref> is reflected by the @class hierarchy of the element. Processors that need to do something with the role do it based on that @class attribute. In the <setupProject> example above, that might be a @class attribute like "- map/topicref taskmap/setupProject ". Processors working with the reference know to render the referenced content based on that value. When <setupProject> instead pulls in content from another map, processors need to preserve that intent. Effectively, they need to preserve awareness of that @class attribute value for topics that are indirectly referenced through the other map.

Specialized topic references achieve this behavior by setting up a default value for the @impose-role attribute on the new element: impose-role="impose".

When a role is imposed in this manner, it does not apply to all content referenced by the element. If a <topicref> refers to a branch of a map, the role is imposed only on the root element of that branch. If a <topicref> refers to an entire map, the role is imposed only on the highest-level topic references within that map. The role does not cascade to other nested referencs within the map. For example, if a <chapter> element applied that role to every reference in another map, that map would be made up only of chapters nested within chapters.

For elements that do not create a role for the referenced content, the @impose-role attribute is defined with a default value indicating that the target of the reference keeps its original role: impose-role="keeptarget". For example, the <mapref> element is a convenience element used to simplify references to other maps. It does not force the content in other maps to be treated as <mapref> - no special role is created for the referenced content. For this reason, it is defined in the grammar file with a fixed value of keeptarget.

In some cases, preserving the role of a referencing element might result in out-of-context content. For example, a <chapter> element in one bookmap could pull in a <part> element from another bookmap, where that referenced <part> also contains nested <chapter> elements. Treating the <part> element as a <chapter> will result in a chapter that nests other chapters, which is not valid in bookmap and might not be understandable by processors. The result is implementation specific. Processors MAY choose to treat this as an error, issue a warning, or simply assign new roles to the problematic elements.

Defining a fixed role for a specialized element

This section is non-normative.

In the Bookmap specialization from the OASIS DITA Technical Communications specializations, the <chapter> element creates a role for the referenced topic. In many contexts (such as a PDF version of the map), this will result in special formatting that identifies the topic as the start of a chapter.

When a chapter element refers to another map, topic references in that other map need to be treated as chapters in order to retain the structure of the book. The @impose-role attribute is set to a fixed value of impose, which lets processors know that the role needs to be preserved for content in the other map.

In an RNG grammar file, this default value can be set as follows:
<optional>
  <attribute name="impose-role" a:defaultValue="keeptarget">
    <value>keeptarget</value>
  </attribute>
</optional>
In a DTD grammar file, this default value can be set as follows:
impose-role
                          (impose)
                                    'impose'

With these fixed values, a <chapter> element that refers to a map will impose the role of "chapter" as expected.

Imposing a role on a branch of a map

This section is non-normative.

In this scenario, a specialized <chapter> element refers to a branch of another map. The chapter element does not need to set the @impose-role attribute directly, because it is defined with a default value in the XML grammar files. The element itself refers to a specific branch of the map, setting the @format attribute to indicate this is a map reference:
<bookmap>
  <!-- ... title, front matter, and other chapters -->
  <chapter href="reusemap.ditamap#examplebranch" format="ditamap"/>
  <!-- additional content -->
</bookmap>
The referenced map contains that branch along with other content:
<map>
  <title>Reusable map branches</title>
  <topicref> <!-- ... --> </topicref>
  <topicref href="parent.dita" id="examplebranch">
    <topicref href="child1.dita"/>
    <topicref href="child2.dita">
      <!-- more children -->
    </topicref>
  </topicref>
  <!-- ... more reusable branches -->
</map>
Because the <chapter> element is defined with a fixed value of impose for the @impose-role attribute, processors will impose the "chapter" role on the reference to parent.dita at the root of the referenced branch. The "chapter" role is not imposed on the child topics in that branch. While processors do not need to literally resolve the content in a normal map, the effective result is similar to this merged map:
<bookmap>
  <!-- ... title, front matter, and other chapters -->
  <chapter href="parent.dita">
    <topicref href="child1.dita"/>
    <topicref href="child2.dita">
      <!-- more children -->
    </topicref>
  </chapter>
  <!-- additional content -->
</bookmap>

Imposing a role on a referenced map

This section is non-normative.

In this scenario, a specialized <chapter> element refers to an entire submap. The chapter element does not need to set the @impose-role attribute directly, because it is defined with a default value in the XML grammar files. The element itself sets the @format attribute to indicate this is a map reference:
<bookmap>
  <!-- ... title, front matter, and other chapters -->
  <chapter href="nestedmap.ditamap" format="ditamap"/>
  <!-- additional content -->
</bookmap>
The referenced map contains three branches as children of the root <map> element:
<map>
  <title>Reusable map branches</title>
  <topicref href="branch1.dita"> <!-- ... --> </topicref>
  <topicref href="branch2.dita">
    <topicref href="child1.dita"/>
    <topicref href="child2.dita">
      <!-- more children -->
    </topicref>
  </topicref>
  <topicref href="branch3.dita"> <!-- ... --> </topicref>
</map>
Because the <chapter> element is defined with a fixed value of impose for the @impose-role attribute, processors will impose the "chapter" role on the highest-level references within the nested map. This means the processors imposes the role of "chapter" on all three branches in the nested map. As with the previous example, the "chapter" role is not imposed on the child topics in each branch. While processors do not need to literally resolve the content in a normal map, the effective result is similar to this merged map:
<bookmap>
  <!-- ... title, front matter, and other chapters -->
  <chapter href="branch1.dita"> <!-- ... --> </chapter>
  <chapter href="branch2.dita">
    <topicref href="child1.dita"/>
    <topicref href="child2.dita">
      <!-- more children -->
    </topicref>
  </chapter>
  <chapter href="branch3.dita"> <!-- ... --> </chapter>
  <!-- additional content -->
</bookmap>

Example: How <topicref> roles are imposed on referenced maps

This section is non-normative.

In this scenario, a specialized <topicref> element references content in another map.

Consider the scenario of a <chapter> element from the Bookmap specialization that references a DITA map. This scenario could take several forms:
Referenced map contains a single top-level <topicref> element
The entire branch functions as if it were included in the bookmap. The "chapter" role is imposed on the branch, with the result that the top-level <topicref> element is processed as if it were the <chapter> element.
Referenced map contains multiple top-level <topicref> elements
The "chapter" role is imposed on each top-level element in the referenced map. Each top-level <topicref> element is processed as if it were a <chapter> element.
Referenced map contains a single <appendix> element
The "chapter" role is imposed on the <appendix> element, which is processed as it were a <chapter> element.
Referenced map contains a single <part> element, with nested <chapter> elements
The "chapter" role is imposed on the <part> element, which is processed as it were a <chapter> element. Nested <chapter> elements might not be understandable by processors, which can treat this as an error or recover as they are able.
<chapter> element references a single <topicref> element rather than a map
The "chapter" role is imposed on the referenced <topicref> element, which is processed as if it were a <chapter> element.

This section is non-normative.

This section of the specification contains simple examples of DITA maps. The examples illustrate a few of the ways that DITA maps are used.

Example: DITA map that references a subordinate map

This section is non-normative.

This example illustrates how one map can reference a subordinate map using either <mapref> or the basic <topicref> element.

The following code sample illustrates how a DITA map can use the specialized <mapref> element to reference another DITA map:

<map>
  <title>DITA work at OASIS</title>
  <topicref href="oasis-dita-technical-committees.dita">
    <topicref href="dita_technical_committee.dita"/>
    <topicref href="dita_adoption_technical_committee.dita"/>
  </topicref>
  <mapref href="oasis-processes.ditamap"/>
  <!-- ... -->
</map>

The <mapref> element is a specialized <topicref> intended to make it easier to reference another map; use of <mapref> is not required for this task. This map also could be tagged in the following way:

<map>
  <title>DITA work at OASIS</title>
  <topicref href="oasis-dita-technical-committees.dita">
    <topicref href="dita_technical_committee.dita"/>
    <topicref href="dita_adoption_technical_committee.dita"/>
  </topicref>
<topicref href="oasis-processes.ditamap" format="ditamap"/>
<!-- ... -->
</map>

With either of the above examples, during processing, the map is resolved in the following way:

<map>
  <title>DITA work at OASIS</title>
  <topicref href="oasis-dita-technical-committees.dita">
    <topicref href="dita_technical_committee.dita"/>
    <topicref href="dita_adoption_technical_committee.dita"/>
  </topicref>
  <!-- Contents of the oasis-processes.ditamap file -->
  <topicref href="oasis-processes.dita">
    <!-- ... -->
  </topicref>
  <!-- ... -->
</map>

Example: DITA map with a simple relationship table

This section is non-normative.

This example illustrates how to interpret a basic three-column relationship table used to maintain links between concept, task, and reference material.

The following example contains the markup for a simple relationship table:

<map>
<!-- ... -->
<reltable>
  <relheader>
    <relcolspec type="concept"/>
    <relcolspec type="task"/>
    <relcolspec type="reference"/>
  </relheader>
  <relrow>
    <relcell>
      <topicref href="A.dita"/>
    </relcell>
    <relcell>
      <topicref href="B.dita"/>
    </relcell>
    <relcell>
      <topicref href="C1.dita"/>
      <topicref href="C2.dita"/>
    </relcell>
  </relrow>
</reltable>
</map>

A DITA-aware tool might represent the relationship table graphically:

type="concept" type="task" type="reference"
A B

C1
C2

When the output is generated, the topics contain the following linkage:

A
Links to B, C1, and C2
B
Links to A, C1, and C2
C1, C2
Links to A and B

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 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