Altova StyleVision 2025 Professional Edition

Table of Contents, Referencing, Bookmarks

Home Prev Top Next

The Table of Contents (TOC) and other referencing mechanisms work by creating anchors at the required points in the design document and then referring back to these references from TOCs, text references, auto-numbering sequences, and hyperlinks.

 

We will look briefly at the anchoring (or bookmarking) mechanism first and then look at the overall TOC mechanism. We do this because understanding the bookmarking mechanism first will provide a better understanding of the overall TOC mechanism.

 

The bookmarking mechanism

Two types of bookmarking mechanism are used: simple and complex. The complex bookmarking mechanism is the one used for creating TOCs.

 

A simple bookmark is created at a point in the design document. The bookmark is given a unique name which is used as the target of links that point to it. This simple bookmarking mechanism is the mechanism used for the Bookmarks and Hyperlinks feature. (Note that hyperlinks can additionally point to URLs outside the document.)

For more complex referencing, such as for TOCs and for the auto-numbering of document sections, building the bookmark involves two parts.

 

1.The design document is structured into a hierarchy of levels required for the TOC. These levels are known as TOC levels. The structuring is achieved by assigning TOC levels to different points in the document structure. TOC levels can be nested within other TOC levels so as to give the document a hierarchical TOC structure. (For example, a TOC level can be assigned to a book chapter, and another TOC level can be assigned within that level to the sections of the chapter.)

2.TOC bookmarks are created within the various TOC levels. These TOC bookmarks identify the document sections at various levels that are to go into the TOC. Additionally, each TOC bookmark must be defined to provide the text that will appear in the referencing component.

 

After the TOC levels and the TOC bookmarks' reference texts have been defined, the TOC template containing the referencing components can be designed.

 

The overall TOC mechanism is broadly described below, under The TOC mechanism. The various referencing features are explained in detail in the rest of this section.

 

The TOC mechanism

If you have selected XSLT 2.0 or XSLT 3.0 (not XSLT 1.0) as the XSLT version of your SPS, you can create a table of contents (TOC)—essentially a template for the TOC—at any location in the design.

 

It is recommended that the items from the design that are to be included in and linked to from the TOC are bookmarked in the design first. These items can be static content or dynamic content. In the bottom half of the screenshot below, yellow TOC bookmark tags tag_TOCBookmark within the header tag indicates that the header item has been bookmarked (for inclusion in the TOC template).

A template is created for the TOC (highlighted in screenshot below). The TOC template contains the design of the TOC; it can be located anywhere in the design. In the example shown in the screenshot below, the TOC template is located near the top of the document.

 

TOCDocOview

 

Note: Either of these two parts can be created first, or both parts can be created concomitantly. We recommend, however, that the TOC bookmarks are created before the TOC template.

 

The TOC is displayed in Authentic View and in the HTML, Text,  and RTF output. Also note that: (i) TOCs can be created with a flat or a hierarchical structure (with corresponding numbering), and (ii) multiple TOCs can be created within a design. As a result, a stylesheet designer can create a document with, say, one (hierarchical) TOC at the book level and others (also hierarchical) at the chapter level, plus (flat) lists of figures and tables.

 

Procedure for creating TOCs

Given below is one step-by-step way of creating a TOC. Items are first bookmarked for inclusion. The TOC template is constructed after that. (Alternatively, you can create the TOC template first, and then bookmark items for inclusion. Or you can create the TOC template and select items for inclusion in parallel.)

 

1.Make sure that XSLT 2.0 is the selected XSLT version.

2.Structure the document in TOC levels. If the TOC is to have multiple levels, structure the document design in a hierarchy of nested TOC levels. If the TOC is to have a flat structure (that is, one level only), then create at least one TOC level (in the document design) that will enclose the TOC bookmarks.

3.Create one or more TOC bookmarks within each level in the document design. The TOC bookmarks identify the components within each TOC level that are to appear in the TOC.

4.Create a TOC template containing TOC level references (levelrefs). The TOC template should have the required number of TOC level references (levelrefs). In the case of a multi-level TOC, the levelrefs in the TOC template should be nested (see screenshot above).

5.Create TOC references (TOCrefs) in the TOC template. In the TOC template, set up a TOCref for each levelref. Each TOCref will reference, by name, the TOC bookmarks within the corresponding TOC level in the document. Alternatively, the TOCref can reference TOC bookmarks in other levels.

6.Format the TOC items. Each text item in the TOC output is generated by a TOCref in the TOC template. TOCref definitions can specify item numbering (including hierarchical), the TOC item text, a leader, and, for paged media, a page number. Each TOCref and its individual parts can be formatted separately as required. (Note that automatic numbering can also be defined within a TOC bookmark in the main body of the document. See the section, Auto-Numbering, for details.)

 

 

Updating TOC page numbers in DOCX and RTF documents

When a user edits a DOCX or RTF output document in MS Word in such a way that the page count changes, it may happen that the TOC is not updated with the new page references. This is an MS Word issue. To update the page references in the TOC, press Ctrl+A to select everything, and then press F9. For more information, see here.

 

Terminology

The names of the main TOC-related components used in the interface are given in the table below. Components have been put in two different columns according to where they occur: in the document body, or in the TOC template (which is the template that specifies the design of the actual Table of Contents and typically occurs at the beginning of the document).

 

The TOC components in the document body mark out items that will be used in the TOC template.

The TOC components in the TOC template reference the marked items in the document body. Components in the TOC template have the word 'reference' in their names.

 

 

Document body

TOC template

TOC level: The TOC levels structure the document in a nested hierarchy.

Level references (levelrefs): Correspond to the TOC-level structure defined in the document body. Enables TOCrefs in a given level to target TOC bookmarks at the corresponding level.

TOC bookmark: Has a name, with which it identifies a node in the document as a TOC item.

TOC references (TOCrefs): References a TOC bookmark by its name.

 

© 2018-2024 Altova GmbH