About Arbortext Styler > Adding Generated Text > Non Standard Numbering with XPath
  
Non Standard Numbering with XPath
This section explores situations in which non standard numbering can be applied in Arbortext Styler via the inclusion of XPath expressions. In this respect, numbering can be generated in Arbortext Styler for elements for which numbering is not usually permitted.
Example: Defining Numbering in Arbortext Styler for Elements not Permitted Numbering
The steps contained in this example will number every occurrence of a particular para context in your document.
1. In the Elements list, highlight the para context that should be numbered. In this instance, the numbering is to be applied to the para everywhere else context.
2. In the Generated text category, elect to add generated text before the element's content. The Generated Text Editor opens.
3. In the Generated Text Editor, choose Insert > XPath String. The Insert XPath String dialog box opens.
4. In the XPath expression field, enter the expression count(preceding-sibling::ELEMENT)+1, where ELEMENT is the name of the sibling element that is to be counted. In this instance, the numbering is to be based on the total number of paragraphs up to the current paragraph so the expression is count(preceding-sibling::para)+1.
5. Click OK to exit the Insert XPath String dialog box. The Generated Text Editor contains a single XPathString object. If you wish to add punctuation after the numbering, add them after the XPath string object - the graphic below shows how to apply a period and a space after the number:
This is an image of the Generated Text Editor for the para everywhere else context, showing an XPathString element followed by a period and a space character
6. Click File > Apply and Close to save your gentext setting and exit the Generated Text Editor. The Before-text field now shows the XPath expression that will be used to generate the numbering for your document's paragraphs, plus the punctuation you included:
This is an image of the Before-text gentext field for the para everywhere else context, showing the gentext element description <_gte:XPathString expr=”count(preceding-sibling::para)+1”/>.
7. Choose Preview > Print.
In the Print Preview window, note that every paragraph begins with a number and a period.