Skip to main content
11-Garnet
December 12, 2022
Solved

Division Level Numbering

  • December 12, 2022
  • 1 reply
  • 1646 views

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

Best answer by ClayHelberg

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.

1 reply

18-Opal
April 20, 2023

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.

11-Garnet
April 21, 2023

Hi Clay,

 

That is excellent - thank you so much!