cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
Showing results for 
Search instead for 
Did you mean: 

Community Tip - New to the community? Learn how to post a question and get help from PTC and industry experts! X

Page Numbering in Page Sets

TrevorN
5-Regular Member

Page Numbering in Page Sets

I am having a problem getting the page numbering to work in my document. The first few pageblocks in my document need to start page numbering at 1. The remaining page blocks have numbering schemes that start at 1000, 3000, 4000, etc. I created conditions to assign the correct page sets at the different page block elements, and set the page number to start according to a pgblknbr attribute (1000, 3000, etc.). However, the page numbering for the entire document uses the attribute number from the last condition, so if the last condition checked returns 3000, all of my pageblocks start with page 3000 instead of the attribute value for that particular page block. I'm not sure if I'm making a mistake in the way that I'm trying to assigning the page number or if I need to use something outside of the basic capabilities of Styler to get the numbering to work.

3 REPLIES 3

In general you can have global and format variables, the format variables track page-to-page and would be the ones to use. How are you setting/tracking the page numbering? For conditions I think it will apply all conditions that match the test which may also explain the behaviour you see. Is your conditional logic correct?

TrevorN
5-Regular Member
(To:GarethOakes)

I set the page numbering for each page block using the page number dropdown in the Breaks category. The conditions test the pgblknbr attribute for each page block to see if the attribute matches a number 1, 1000, 2000, 3000, etc. If the attribute number matches a number, the page numbering for that page block should start with that number.

 

 

 

I see what you mean. I don't like the condition checks because you then can't have manually controlled numbering, only the values you specifically support in the stylesheet. I got this working in "out of the box" Docbook stylesheet but making an APP source edit. In this case it was for the "chapter" element, but basically I updated the code as follows:

1. Right-click the "chapter everywhere" context.

2. Select "Edit Context Source" -> "APP"

3. In the code, find the line where page number is set and edit as follows:

contextProp.pageNumber = Number(formatting.evaluateXPath( "@label" ) || 0);

Now it picks up the label attribute and uses that value as the page number. This works because "chapter" starts a new page - as I understand it you can't change the page number for elements that don't start a new page. I also use the "|| 0" bit at the end for the case where no label attribute exists, in that case the zero value causes the page numbering to simply continue from the previous page.

You will have to adjust the above to match your stylesheet but hopefully that gives you a good steer.

Top Tags