Read XSLT 2.0 and XPath 2.0 Programmer's Reference, 4th Edition Online
Authors: Michael Kay
It wouldn't be difficult to write a parameterized template that handled all the
The templates to calculate section numbers have one variant for each level of heading, and also vary depending on whether the section is in the
(a main section) or in the
count=“div1 | div2 | div3 | inform-div1” format=“A.1.1 ”/>
All these templates work by calling
level=“single”
is used for the top-level headings, and
level=“multiple”
for all other levels, with a
count
attribute that matches that level and all ancestor levels. The format of the numbering is adjusted for appendices (sections with
Giving a list of alternatives in the
count
attribute is a common way of doing multilevel numbering. It means, in effect, outputting a sequence number for each ancestor element that is either an
The use of
normative=“no”
. Sadly, it is often the case that stylesheet authors have to cope with XML structures that could have been designed better. In XSLT 2.0, if this stylesheet were schema aware, it's likely that
div1
in these template rules by
schema-element(div1)
, which would pick up the