xml spy
Previous  Top  Next

Auto-Numbering


Repeating instances of a node can be numbered automatically using StyleVision's Auto-Numbering feature. For example, in a Book element that contains multiple Chapter elements, each Chapter element can be numbered automatically using the Auto-Numbering feature. This is an easy way to insert numbering based on the structure of the XML document. Auto-Numbering can be either flat or hierarchical, and there is a wide variety of formatting available for the numbers.

 

 

Flat (sequential) numbering

Flat numbering can be inserted within a TOC Reference or within a TOC Bookmark. Within a TOC Reference, flat numbering will point back to a bookmark in the document; it would be a TOC entry and is described in the Table of Contents (TOC) section. In this section, we describe how to create flat numbering within a TOC Bookmark in the document. Such numbering can be independent of a TOC. To create flat numbering in a document, do the following:

 

1.Place the cursor within the node that has to be numbered and create the TOC Bookmark (right-click, and select Insert Table of Contents | TOC Bookmark). The TOC Bookmark will be created.
2.Place the cursor within the tags of the TOC Bookmark, right-click, and select Insert Table of Contents | Sequential Numbering. This inserts the Auto-Numbering placeholder for flat (sequential) numbering, (num-seq) (highlighted within the TOC Bookmark 'TopicHeader' in the screenshot below).

 

AutoNumSeqDesign

 

3.Right-click the TOC Bookmark and toggle off the command Construct Entry Text Using XPath. This is because: (i) the TOC Bookmark is being used solely for flat numbering and not for TOC entries; no text entry for TOC entries is required; and (ii) to ensure that no faulty XPath expressionthat can cause a transformation erroris used.
4.There is no need to name the TOC Bookmark (since it will not be referenced from a TOC template), but you could name it if you wish (right-click the TOC Bookmark and select the Edit Name command).

 

In the example shown in the screenshot above, flat numbering has been set on the Topic node. The result is that each Topic element receives a sequential number, as shown in the screenshot below.

 

AutoNumSeqOutput

 

Note:If the flat numbering must be continued on another set of nodes, then use a TOC Bookmark that has the same name as that of the TOC Bookmark from which the numbering is to be continued.

 

 

Hierarchical numbering

Hierarchical numbering can be inserted within a Reflevel or within a Level in the design. Within a Reflevel, hierarchical numbering will point back to a TOC bookmark in the document; it would be a TOC entry and is described in the Table of Contents (TOC) section. In this section, we describe how to create hierarchical numbering within levels in the document. Such hierarchical numbering can be independent of a TOC.

 

To create hierarchical numbering in a document, you must first structure the document in levels and create levels as described in the section Structuring the Design in Levels. The following points should be borne in mind:

 

Levels must be created either on the node to be numbered or within it.
Levels must be nested according to the hierarchy of the numbering required (see screenshot below).
The hierarchical numbering placeholder must be inserted within the corresponding level in teh design (see screenshot below).

 

AutoNumHierarchicalDesign

 

In the screenshot above, there are two levels. The topic element is recursive, and a level has been created on two topic elements (by right-clicking the node tag and selecting Template Serves as Level). One topic element (highlighted in the screenshot above) is nested within the other. As a result, the levels are nested. Within each level, a hierarchical numbering placeholder (num-lvl) has been inserted (right-click within the level and select Insert Table of Contents | Sequential Numbering).

 

The result of the design shown in the screenshot above will look like this.

 

AutoNumHierarchicalOutput

 

The first level is shown in bold, the second in normal.

 

 

Formatting

To format the Auto-Numbering, right-click the Auto-Numbering placeholder ((num-seq) or (num-lvl)) and select Edit Format. This pops up the respective dialogs (screenshots below), in which you can select the required formatting from a range of options.

 

Sequential numbering: Select a numbering style. The selection is is displayed in the Format String box and can be modified there if required.

 

AutoNumSeqFormat

 

Hierarchical numbering: First select the numbering style and then the number of tokens. The resulting format string is displayed in the Format String box. Levels can be omitted by entering the required number of levels to be omitted in the Omit Levels box.

 

AutoNumHierarchicalFormat

 

Click OK when done.

 

 


See also:

 

 


 

 

 

 

 

 

 

 

 

 

 


Previous  Top  Next

© 2008 Altova