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

Community Tip - Need help navigating or using the PTC Community? Contact the community team. X

Division Level Numbering

JohnLaidlaw
10-Marble

Division Level Numbering

Hello!

 

I am attempting to modify numbering behaviour for a division level 2 element. My customer has a requirement for this element (applied to sect1 in the Docbook DTD) to start at 00, then increment by five for each new sect1. So, 00, 05, 10, 15, and so on.

 

As the only increment available is by one, I have been investigating the APP Funtion Numbering module in Styler (currently at 8.1.2.1). The relevant section has this code:

 

if ( argv.countAs != '' ) {
var number = formatting.fish[ template.numberingFish ][ argv.countAs ];
if ( number == '' || number == null ) {
number = startAt;
} else {
number = Number(number) + 1;
}

formatting.fish[ template.numberingFish ][ argv.countAs ] = number.toString();
if ( argv.numberXPath == '' ) {
argv.numberXPath = number;
argv.initialNumber = 0;
}
}

 

If I change the line 'number = Number(number) + 1' to 'number = Number(number) + 5', the sect1s increment by 5, but so does everything else with a Division style.

 

I need to test for which division level and apply the increment of 5 to level 2, but for the life of me cannot work out how to do this, nor can I find a reference that will point me in the right direction. Does anyone know either how to do this, or be able to tell me where this documentation may exist?

 

Many thanks in advance!

 

John Laidlaw

1 ACCEPTED SOLUTION

Accepted Solutions

Hi John--

 

Sorry for the late reply, but hopefully it's still useful. You probably don't need to resort to APP edits to do this, you should be able to do what you intend using standard Styler features with a dash of XPath. In the Division Title Number dialog, you can specify an XPath override for the number, and you can do your x5 modification there. Here's a quick example I mocked up with a copy of the axdocbook stylesheet.

ClayHelberg_0-1682021655570.png

Hopefully you can adapt this approach to your need.

View solution in original post

2 REPLIES 2

Hi John--

 

Sorry for the late reply, but hopefully it's still useful. You probably don't need to resort to APP edits to do this, you should be able to do what you intend using standard Styler features with a dash of XPath. In the Division Title Number dialog, you can specify an XPath override for the number, and you can do your x5 modification there. Here's a quick example I mocked up with a copy of the axdocbook stylesheet.

ClayHelberg_0-1682021655570.png

Hopefully you can adapt this approach to your need.

Hi Clay,

 

That is excellent - thank you so much!

Top Tags