Shallow Numbering for Chapters and SectionsEdit online
<topicref> elements that are placed on the first level.
For bookmaps, the chapters are the topics referenced by a
<chapter> element. Shallow Numbering - Input XML FragmentsEdit online
The numbering affects three parts of your publication, the table of contents, headers/footers, and chapter 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>
<opentopic:map> element contains the effective table of
contents structure.- map/topicref.@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.
<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>
<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>
<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>
<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>
<opentopic:map> element.- topic/topic
included in the parents.@is-chapter attribute
set.The Titles of Chapters
<topic class="- topic/topic " id="unique_2" oid="dcpp_parameters"> <title class="- topic/title ">Parameters</title> ... </topic>
<div class="- topic/topic topic" id="unique_2" oid="dcpp_parameters"> <div class="- topic/title title ">Parameters</div> ... </div>
- topic/title. The actual element
name can be different.Shallow Numbering - Built-in CSSEdit online
There is a file located in [PLUGIN_DIR]/css/print/p-numbering-shallow. The following examples are from this file.
The counters should be reset on the root element. This is the element that has the class
map/map. Note that bookmaps derive from maps and the following selector
will also match them:
*[class ~= "map/map"] { counter-reset: page 1 toc-chapter 0 chapter 0 figcount 0 tablecount 0; }
Table of Contents
toc-chapter. This is
reset on the book parts (for bookmaps) and is incremented on each chapter that is not a
part.*[class ~= "map/topicref"][is-chapter]:not([is-part]) { counter-increment:toc-chapter; } *[class ~= "map/topicref"][is-part] { counter-reset:toc-chapter !important; counter-increment:toc-part; } /* All other topicrefs that follow a part should not have a number (i.e appendices) */ *[class ~= "map/topicref"][is-part] ~ *[class ~= "map/topicref"]:not([is-part]) > *[class ~= "map/topicmeta"] > *[class ~= "topic/navtitle"]:before{ content: none !important; counter-increment:none; }
:before pseudo element is used on the
navigation titles from the <topicref>
elements:*[class ~= "map/topicref"][is-part] > *[class ~= "map/topicmeta"] > *[class ~= "topic/navtitle"]:before{ content:"Part " counter(toc-part, upper-roman) ". " !important; color:inherit; } *[class ~= "map/topicref"][is-chapter]:not([is-part]) > *[class ~= "map/topicmeta"] > *[class ~= "topic/navtitle"]:before{ content:"Chapter " counter(toc-chapter) ". " !important; color:inherit; }
The Titles of Chapters in the Main Content
part and chapter counters are incremented on the
elements that have the class
topic/topic:*[class ~= "topic/topic"][is-part]{ counter-increment:part; counter-reset:chapter; } *[class ~= "topic/topic"][is-chapter]:not([is-part]){ counter-increment:chapter; }Except for
<frontmatter>, <backmatter>, and other
topics following the last book part (for
bookmaps).*[class ~= "bookmap/frontmatter"], *[class ~= "bookmap/frontmatter"] *[class ~= "topic/topic"], *[class ~= "bookmap/backmatter"], *[class ~= "bookmap/backmatter"] *[class ~= "topic/topic"], *[class ~= "topic/topic"][is-part] ~ *[class ~= "topic/topic"]:not([is-part]) { counter-increment:none !important; counter-reset: chapter part; }
*[class ~= "topic/topic"][is-part] > *[class ~= "topic/title"]:before { content: "Part " counter(part, upper-roman) ". "; } *[class ~= "topic/topic"][is-chapter]:not([is-part]) > *[class ~= "topic/title"]:before { content: "Chapter " counter(chapter) ". "; }
<frontmatter>, <backmatter>, and
other topics following the last book part (for
bookmaps).*[class ~= "bookmap/frontmatter"] > *[class ~= "topic/title"]:before, *[class ~= "bookmap/frontmatter"] *[class ~= "topic/topic"] > *[class ~= "topic/title"]:before, *[class ~= "bookmap/backmatter"] > *[class ~= "topic/title"]:before, *[class ~= "bookmap/backmatter"] *[class ~= "topic/topic"] > *[class ~= "topic/title"]:before, *[class ~= "topic/topic"][is-part] ~ *[class ~= "topic/topic"]:not([is-part]) > *[class ~= "topic/title"]:before, *[class ~= "topic/topic"][is-part] ~ *[class ~= "topic/topic"]:not([is-part]) *[class ~= "topic/topic"] > *[class ~= "topic/title"]:before{ content:none !important; }
Headers
part and
chapter
counters:*[class ~= "topic/topic"][is-part] > *[class ~= "topic/title"] { string-set: parttitle " | " counter(part, upper-roman) " - " content(), chaptertitle ""; /* Avoid propagating a past chapter title on a new part */ } *[class ~= "topic/topic"][is-chapter]:not([is-part]) > *[class ~= "topic/title"] { string-set: chaptertitle " | " counter(chapter) " - " content(); }
*[class ~= "bookmap/frontmatter"] > *[class ~= "topic/title"], *[class ~= "bookmap/frontmatter"] *[class ~= "topic/topic"] > *[class ~= "topic/title"], *[class ~= "bookmap/backmatter"] > *[class ~= "topic/title"], *[class ~= "bookmap/backmatter"] *[class ~= "topic/topic"] > *[class ~= "topic/title"], *[class ~= "topic/topic"][is-part] ~ *[class ~= "topic/topic"]:not([is-part]) > *[class ~= "topic/title"], *[class ~= "topic/topic"][is-part] ~ *[class ~= "topic/topic"]:not([is-part]) *[class ~= "topic/topic"] > *[class ~= "topic/title"]{ string-set: parttitle "", chaptertitle ""; }