About Arbortext Styler > Adding Generated Text > Advanced Formatting of Titles and Numbering > Example: Start Document's Page Numbers Based on Attribute Value
Example: Start Document's Page Numbers Based on Attribute Value
This example describes how to configure a document such that its page numbers start at the value of an attribute declared for the root element. The document is based on a document element, which includes a startpagenum attribute to define the first page number.
1. In the Elements list, select the document everywhere context.
2. Create a condition for the context that tests that the attribute startpagenum has any value.
If your DTD or schema assigns a default value to the number attribute you can skip this step since the attribute will always have a value when it appears. Otherwise you must create a condition that tests for the attribute having a value or Arbortext Styler will throw an error when it attempts to apply the configured numbering and does not encounter a Start At value.
3. Navigate to the Breaks category for the context. In the Page set field, assign a page set that includes a page number declaration in its header or footer by selecting the page set's name from the Name menu.
4. Still in the Page set field, click the Start at button to invoke the Page Number Start At dialog box.
5. In the dialog box, configure the following settings:
Start at: Attribute
Element to get attribute from: Current element
Attribute name: startpagenum
6. Save the change and exit the dialog box.
7. When previewing or publishing you will now see that the page numbers for the document will start at the value given to the startpagenum attribute on the document element.
There is a limitation in FOSI print/PDF outputs that you can only alter the page number of the first page of the entire document, as described above. As such certain implementations of numbering of this type will not work correctly. For example, if the chapter everywhere context specifies to set the starting page number to the value of its startpagenum attribute, and if there are five chapters that all specify that attribute, you would expect each chapter to start on the page indicated by that chapter's startpagenum attribute. This will happen if you elect to publish via the XSL-FO and PTC ALD engines. In FOSI outputs the first page of the document, and any other place where the Breaks category specifies Initial for the page number, will display whatever the last chapter set as its starting page number.