Mapping selection

When DITA mode is enabled, mapping selection is enhanced to use the inheritance information in the class attribute. This allows a mapping to be used not only for a specific element, but for all elements that inherit from it.

For each element, mapping selection in DITA mode works as follows:

  1. The mappings are first searched using the actual name of the element and its ancestor elements.

  2. If no mapping is found using the above, the search is repeated using the actual element names as well as the element names contained in the class attributes.

For example, consider the following fragment of data:

<steps class="- topic/ol task/steps ">
    <step class="- topic/li task/step ">

and a mapping with tag-in-context of ol/li. When processing the <step> element the mapping will not be matched during step (1) above because the element names do not match. During step (2) the matching will be extended to include the element names “ol” and “li” in the class attributes, so the mapping will be matched.

During the step (2) matching the syntax “module#element” can be used to explicitly match a component of the class attribute. Thus in the example above the mapping could also have been specified as topic#ol/topic#li.

The precedence rules apply during the step (2) matching for deciding between mappings with the same target element name. However, there is no rule to decide between mappings with different target element names. For example if the data is:

<c class="- mod/c mod/b mod/a ">

and there are mappings for elements “a” and “b” but not “c” there is no rule for which of the “a” or “b” mappings will be selected. The mapping priority can be used to resolve any ambiguity that this causes.