Edit online

The topics in this section contain some technical details in case you need to fine-tune the way the numbering works.

Edit online

The built-in CSS rules are in:

  • [PLUGIN_DIR]/css/print/p-numbering-shallow.css
  • [PLUGIN_DIR]/css/print/p-numbering-deep.css
  • [PLUGIN_DIR]/css/print/p-numbering-deep-chapter-scope.css
  • [PLUGIN_DIR]/css/print/p-numbering-deep-chapter-scope-no-page-reset.css

The first CSS (shallow) contains rules that add a "Chapter NN" before the first-level topics from the publication, the second one (deep) contains rules that add a deep structure of counters on all topics referenced from the map (at any level), the third one (chapter-scope) creates a chapter scope-oriented numbering (meaning that the numbering for pages, tables, figures, and links to them are reset for each chapter), and the last one is similar to the third except that page numbers do not reset. For more details, see Numbering Types.

Edit online

The numbering affects multiple logical parts of your publication, the table of contents, headers/footers, chapter titles, figures and tables titles:

The Table of Contents

The table of contents is a tree of <topicref> elements.

<map xmlns:ditaarch="http://dita.oasis-open.org/architecture/2005/" ...>
  <oxy:front-page xmlns:oxy="http://www.oxygenxml.com/extensions/author" 
        class=" front-page/front-page ">
        ...
  </oxy:front-page>
  <opentopic:map xmlns:opentopic="http://www.idiominc.com/opentopic" class=" toc/toc ">
    <title class="- topic/title ">Publication Title</title>

    <topicref is-chapter="true" class="- map/topicref " ... >
      <topicmeta class="- map/topicmeta " ... >
        <navtitle href="#unique_1" class="- topic/navtitle ">Overview</navtitle>
            ...
      </topicmeta>
      <topicref class="- map/topicref " ...>
        <topicmeta class="- map/topicmeta " data-topic-id="dcpp_resources">
          <navtitle href="#unique_2" class="- topic/navtitle ">Resources</navtitle>
            ...
        </topicmeta>
      </topicref>
        ...
  </opentopic:map>
...
</map>
Note: The <opentopic:map> element contains the effective table of contents structure.
Note: The TOC items are the elements with the class: - map/topicref.
Note: The ones identified as chapters have the @is-chapter attribute set.

For the DITA Map PDF - based on HTML5 & CSS transformation type, the merged map is further processed resulting in a collection of HTML5 <div> elements. These elements preserve the original DITA @class attribute values and add a new value derived from the DITA element name.

<div class="- map/map map" ...>
  <div 
        class=" front-page/front-page front-page">
        ...
  </div>
  <div class=" toc/toc toc">
    <div class="- topic/title title">Publication Title</title>

    <div is-chapter="true" class="- map/topicref topicref" ... >
      <div class="- map/topicmeta topicmeta" ... >
        <div href="#unique_1" class="- topic/navtitle navtitle">Overview</div>
            ...
      </div>
      <div class="- map/topicref " ...>
        <div class="- map/topicmeta " data-topic-id="dcpp_resources">
          <div href="#unique_2" class="- topic/navtitle ">Resources</div>
            ...
        </div>
      </div>
        ...
  </div>
...
</div>

The Header and Footers

These are based on string sets generated for the titles. The complete set of strings is defined in: [INSTALLATION_DIR]/css/print/p-pages-and-headers.css.

The CSS rules that build the string sets are matching the map title from the front page and the titles from the content.
<oxy:front-page xmlns:oxy="http://www.oxygenxml.com/extensions/author">
        <oxy:front-page-title>
            <title class="- topic/title ">Publication Title</title>
        </oxy:front-page-title>
</oxy:front-page>
For the DITA Map PDF - based on HTML5 & CSS transformations:
<div class=" front-page/front-page front-page">
        <div class=" front-page-title/front-page-title front-page-title">
            <div class="- topic/title title ">Publication Title</div>
        </div>
</div>
The main content is organized as follows:
<map xmlns:ditaarch="http://dita.oasis-open.org/architecture/2005/" ...>
    ...
    <opentopic:map xmlns:opentopic="http://www.idiominc.com/opentopic">
      ...
    </opentopic:map>

    <topic is-chapter="true" oid="dcpp_overview">
        <title class="- topic/title ">Overview</title>
        <body class="- topic/body ">
            ...
        </body>
        <topic class="- topic/topic " id="unique_2" oid="dcpp_resources">
            <title class="- topic/title ">Resources</title>
            ...
        </topic>
        <topic class="- topic/topic " id="unique_2" oid="dcpp_parameters">
            <title class="- topic/title ">Parameters</title>
            ...
        </topic>
    </topic>
For the DITA Map PDF - based on HTML5 & CSS transformations:
<div class=" map/map map" ...>
    ...
   <div class=" toc/toc toc">
      ...
    </div>

    <div is-chapter="true" oid="dcpp_overview" class="- topic/topic topic">
        <div class="- topic/title title">Overview</title>
        <div class="- topic/body body">
            ...
        </div>
        <div class="- topic/topic topic" id="unique_2" oid="dcpp_resources">
            <div class="- topic/title title">Resources</div>
            ...
        </div>
        <div class="- topic/topic topic" id="unique_2" oid="dcpp_parameters">
            <div class="- topic/title title">Parameters</div>
            ...
        </div>
    </div>
Note: The topic content comes after the <opentopic:map> element.
Note: The child topics are the elements that have the class - topic/topic included in the parents.
Note: The ones identified as chapters have the @is-chapter attribute set.

The Titles of Chapters

The titles from the content are children of the topics:
<topic class="- topic/topic " id="unique_2" oid="dcpp_parameters">
        <title class="- topic/title ">Parameters</title>
            ...
</topic>
For the DITA Map PDF - based on HTML5 & CSS transformations:
<div class="- topic/topic topic" id="unique_2" oid="dcpp_parameters">
        <div class="- topic/title title ">Parameters</div>
            ...
</div>
Note: The title elements have the class: - topic/title. The actual element name can be different.

Edit online

The type of numbering is controlled by the parameter args.css.param.numbering.

This parameter activates various sets of CSS rules from the built-in CSS. By default, only the first-level topics (the chapters) are numbered (shallow numbering). The following values are accepted:

Table 1. Types of Numbering
Value Chapters Sections Figures & Tables Pages
shallow numbered no counted from the start of the publication from the start of the publication
deep numbered numbered counted from the start of the publication from the start of the publication
deep-chapter-scope numbered numbered numbering is restarted at the beginning of each chapter, adds the chapter number in their titles (and in the links to them), and in the list of tables and list of figures sections restarted at the beginning of each chapter
deep-chapter-scope-no-page-reset numbered numbered numbering is restarted at the beginning of each chapter, adds the chapter number in their titles (and in the links to them), and in the list of tables and list of figures sections from the start of the publication
Note: The deep-chapter-scope and deep-chapter-scope-no-page-reset values are only available for the DITA Map PDF - based on HTML5 & CSS transformation scenario.

Examples

Shallow
Each chapter (or first-level topic) is numbered, but nested topics are not numbered. Figures, tables, and pages are numbered sequentially from the start of the publication and they do not reset.
1. First Chapter
    Page 1
      Topic
        Table 1
        Table 2
      Topic
    Page 2
        Table 3
2. Second Chapter
    Page 3
      Topic
        Table 4
        Table 5
      Topic
    Page 4
Deep
Each chapter (or first-level topic) and nested topics are numbered (these are also prefixed with the chapter number). Figures, tables, and pages are numbered sequentially from the start of the publication and they do not reset.
1. First Chapter
    Page 1
      Topic 1.1
        Table 1
      Topic 1.2
        Table 2
    Page 2
        Table 3
2. Second Chapter
    Page 3
      Topic 2.1
        Table 4
        Table 5
      Topic 2.2
    Page 4
Deep Chapter Scope
Each chapter (or first-level topic ) is independent (so it can be read separately, as a separate part of your publication). The nested topics, page, figure, and table counters (and links to them) restart at each chapter. The general cross reference links also display the chapter number before the page number to clearly specify the target.
1. First Chapter
    Page 1.1
      Topic 1.1
        Table 1.1
        Link to page 2.2
      Topic 1.2
    Page 1.2
        Table 1.2
2. Second Chapter
    Page 2.1
      Topic 2.1
        Table 2.1
        Table 2.2
        Table 2.3
      Topic 2.2
        Table 2.4
    Page 2.2
       Link to page 1.1
Deep Chapter Scope No Page Reset
Each chapter (or first-level topic) is independent (so it can be read separately, as a separate part of your publication). The nested topics, figure, and table counters (and links to them) restart at each chapter, but the page numbers do not reset. The generic cross reference links contain only the page number.
1. First Chapter
    Page 1
      Topic 1.1
        Table 1.1
        Link to page 4
      Topic 1.2
    Page 2
        Table 1.2
2. Second Chapter
    Page 3
      Topic 2.1
        Table 2.1
        Table 2.2
        Table 2.3
      Topic 2.2
        Table 2.4
    Page 4
       Link to page 1

Edit online

If you are using the shallow numbering CSS (this is the default), and you want to hide the "Chapter" prefix, use the following rules in your customization CSS:

For the TOC:

*[class ~= "map/topicmeta"] > *[class ~= "topic/navtitle"]:before {
    display:none !important; 
}

For the titles in the content, change the content of the title :before (this example just uses the chapter number):

*[class ~= "topic/topic"][is-chapter]:not([is-part]) > *[class ~= "topic/title"]:before {
    content: counter(chapter) ". " !important;
}

Edit online

The page numbers are reset to one of two cases:

  • On the first topic that follows the TOC.
  • On the first topic from the index.

To avoid the page counter from being reset, use the following rules in your customization CSS:

*[class ~= "map/map"] > *[class ~= "toc/toc"] + *[class ~= "topic/topic"],
*[class ~= "index/groups"] {
  counter-reset: none;
}

The index page also changes the format of the page numbers to lower alpha characters. To switch to decimal characters, use:

@page index {
  @bottom-center {
    content: counter(page, decimal)
  }
}