#### 6.4.1 Understanding element paths

When you map DITA elements to output formats, you might have to consider the position of an element in the document structure before you choose an appropriate output format. For example, the amount that text should be indented might be a function of the depth of nesting of the element that contains the text; so the same element at different levels in the hierarchy might have to be mapped to a different output format with different indentation properties. For an example, see §6.4.4 Mapping the same element to different formats.

You can restrict the mapping of a given inline or block element (or element set; see §11.1 Defining sets of elements) to a particular position in the hierarchy by specifying the element path to be considered.

An element path specifies the relationship of an element to the top of the top-level map. The relationship is expressed as a reversed path starting with the current element, through the root of the topic, ending with a number representing the topic depth in the current project, where 1 is the first possible level for topics. This is simply an inverted tree to the topic root, ending with the depth of the topic in the complete map (treated as though any nested maps were replaced by their top-level content).

An element path ends with a level number

An element path consists of the name of the current element, followed by the names of its parents in ascending order, up to and including the root XML element, and ending with a number that represents the nesting level of the root element in its XML file in the final document structure.

For example:

p/section/conbody/concept/3

This is the element path for a <p> body element in any <section> of a <concept> topic that is two levels down from the top-level topics.

When the level number of an element path is greater than 1, meaning that it is referenced from a map below the top level, DITA2Go generates a second path, the extended element path. This extended path continues up to the top level, and is normalized by omitting any topicref/map/ pairs that are below the top level. DITA2Go checks the extended path first, and uses the shorter path only if the extended path has no match.

Element path syntax

Element names in an element path are separated by forward slashes. To specify that an element must be first under its parent, use a ^ instead of /. Wildcards ? and * are allowed at any point.

For example:

li^ol/* First item in any ordered list at any level
li/ol/* Any non-first item in any ordered list at any level
li/ul/* Any item in any unordered list at any level

Previous Topic: 6.4 Mapping element paths to output formats

Next Topic: 6.4.2 Mapping block and inline element paths to formats

Parent Topic: 6.4 Mapping element paths to output formats

Sibling Topics:

6.4.2 Mapping block and inline element paths to formats

6.4.3 Overriding element paths for default formats

6.4.4 Mapping the same element to different formats

6.4.5 Filtering out elements via format mapping

Table of Contents • Index