Entries and levels

A TOC consists of a series of entries. Each entry typically contains a title and a label that identifies the position in a document at which the entry occurs. In addition, each entry occupies a particular level in the TOC hierarchy. A simple list of chapters has only one level, but a more complex TOC tends to have a structure reflecting that of the original document. The following TOC fragment has three levels:

In the simplest case, the mapping that produces the heading (for example, chapter/title) can also create the TOC entry. This is done on the Content tab of the mapping.

Tick the Assign to TOC level box and select a level. Up to 9 levels are provided, though it is rare to use more than three or four in practice.

The content of any occurrence of the mapped element will be assigned to a TOC entry, including any internal tagging which may be present. The following sections will explain how to make use of this captured material.

For more complex situations, such as where the TOC text is not always the same as the heading, you may need to insert a custom marker into the custom content of the mapping.

For example, say the title element has an attribute which has the value no when the heading should not appear in the TOC. In the mapping for the title, set the Scan element content option and place the following in a user customisation:

<if var="@toc" target="no" test="not-same">
    <Toc1><content/></Toc>
</if>

The %Toc1 custom mapping can then be used to create the TOC entry.