The containing element for a map is the <map> element. Within the map, use the <topicref> element to add and organize references to the topics, and the <topicgroup> and <reltable> elements to provide non-hierarchical relationships. You can use the <map> element to set default attribute values for all <topicref> elements in the map.
A map describes the relationships among a set of DITA topics. The following are some examples of relationships that can be described in a map:
- Hierarchical (Parent/Child). Nested topics create a hierarchical relationship. The topic that does the nesting is the parent, and the topics that are nested are the children.
- Ordered. Child topics can be labeled as having an ordered relationship, which means they are referenced in a definite sequence.
- Family. Child topics can be labeled as having a family relationship, which means they all refer to each other.
When rendering a map, processors might make use of these relationships, such as to create a Table of Contents (TOC), aggregate topics into a PDF document, or create links between topics in output.
The <title> element can optionally be used to provide a title for the map (the <title> element is preferred over the @title attribute). In some scenarios the title is purely informational, and is present as an aid to the author. In other scenarios it might be useful or even required. For example, if a map is converted to Eclipse Help, the Eclipse system will require a title for the resulting table of contents. In the <bookmap> specialization of <map>, the <title> element provides a title for the book represented by that map. In a map referenced by another map, the <title> might be discarded as topics from the submap are aggregated into a larger publication.
See appendix for information about this element in OASIS document type shells.
In this example, there are six <topicref> elements. They are nested and
have a hierarchical relationship. The file
bats.dita is the parent
topic and the other topics are its children. The hierarchy could be used to generate
a navigation pane in an information center, a summary of the topics, or related links
between the parent topic and its children.
<map id="mybats"> <title>Bats</title> <topicref href="bats.dita" type="topic"> <topicref href="batcaring.dita" type="task"></topicref> <topicref href="batfeeding.dita" type="task"></topicref> <topicref href="batsonar.dita" type="concept"></topicref> <topicref href="batguano.dita" type="reference"></topicref> <topicref href="bathistory.dita" type="reference"></topicref> </topicref> </map>
The following attributes are available on this element: Universal attribute group (with a narrowed definition of @id, given below), Attributes common to many map elements, Architectural attribute group, @outputclass, and the attributes defined below. This element also uses @type, @scope, and @format from Link relationship attribute group.
- Allows an ID to be specified for the map. Note that maps do not require IDs (unlike topics), and the map ID is not included in references to elements within a map. This attribute is defined with the XML Data Type ID.
- Identifies a location within another map
document where this map will be anchored.
Resolution of the map is deferred until the final
step in the delivery of any rendered content. For
anchorref="map1.ditamap#a1"allows the map with @anchorref to be pulled into the location of the anchor point "a1" inside
map1.ditamapis rendered for delivery.