Multipart numbering

All previous examples have worked at a single level – either at the same level as the current element, or at some level higher in the document. A single list of siblings is counted, and numbered as required. However, there may be a need to present numbers that include several counters. Formal documents in particular tend to include such numbers as '1.2.7.3' or 'A–6–iv'. This effect can of course be achieved using multiple Number elements, arranged in sequence:

<xsl:template match="title">
  <P><xsl:number count="chapter" .../>.
    <xsl:number count="section" ..."/>
    <apply-templates/>
  </P>
</xsl:template>

However, this approach can be quite clumsy when dealing with several levels. As an alternative approach, the Level attribute ...

Get XSL companion, The now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.