Chapter and Topic Nesting

Post here questions and problems related to editing and publishing DITA content.
SunilCP
Posts: 10
Joined: Wed Jan 04, 2023 8:44 am

Chapter and Topic Nesting

Post by SunilCP »

There is a map/ ditamap as follows :
image.png
image.png (4.42 KiB) Viewed 535 times
When I add this as a chapter in bookmap and generate the PDF using css transformation, the output is as follows:
image.png
image.png (10.2 KiB) Viewed 535 times
I wanted all the topics nested under the ditamap to be under one chapter "Introduction"
All the topics are set to @is-chapter = true, so all the topics are considered as chapters.
How to change the css to ensure that these topics are not considered as chapters, any thoughts?
julien_lacour
Posts: 498
Joined: Wed Oct 16, 2019 3:47 pm

Re: Chapter and Topic Nesting

Post by julien_lacour »

Hello,

This is a normal behavior, if you take a look at the DITA Specification for <mapref> element (same as setting format="ditamap") you will find:
The hierarchy of the referenced map is merged into the container map at the position of the reference...
One solution to create an additional level is to add a <topichead> element into the referred map:

Code: Select all

<map>
    <topichead navtitle="Introduction">
        <topicref href="installation_process_and_deliverables.dita"/>
        <topicref href="system_and_bios_requirements.dita"/>
        <topicref href="installation_process_and_deliverables.dita"/>
        <topicref href="installation_process_and_deliverables.dita"/>
    </topichead>
</map>
Regards,
Julien
chrispitude
Posts: 907
Joined: Thu May 02, 2019 2:32 pm

Re: Chapter and Topic Nesting

Post by chrispitude »

Building on Julien's suggestion, you can place the

Code: Select all

<topichead>
in either the submap file:

Code: Select all

<!-- chapter_submap.ditamap -->
<map>
    <topichead navtitle="Introduction">
        <topicref href="installation_process_and_deliverables.dita"/>
        <topicref href="system_and_bios_requirements.dita"/>
        <topicref href="installation_process_and_deliverables.dita"/>
        <topicref href="installation_process_and_deliverables.dita"/>
    </topichead>
</map>
or in the top-level map file:

Code: Select all

<!-- top.ditamap -->
<map>
    <topichead navtitle="Introduction">
        <mapref href="chapter_submap.ditamap"/>
    </topichead>
</map>
In either case (heading in the top-level map or in the submap), you can use a topic file instead of a <topichead> to provide the heading:

Code: Select all

<!-- chapter_submap.ditamap -->
<map>
    <topicref href="introduction.dita">
        <topicref href="installation_process_and_deliverables.dita"/>
        <topicref href="system_and_bios_requirements.dita"/>
        <topicref href="installation_process_and_deliverables.dita"/>
        <topicref href="installation_process_and_deliverables.dita"/>
    </topicref>
</map>

Code: Select all

<!-- top.ditamap -->
<map>
    <topicref href="introduction.dita">
        <mapref href="chapter_submap.ditamap"/>
    </topicref>
</map>
This provides an opportunity to provide a chapter abstract, brief overview of the content, etc.
SunilCP
Posts: 10
Joined: Wed Jan 04, 2023 8:44 am

Re: Chapter and Topic Nesting

Post by SunilCP »

Thanks for the suggestions. It works.
Post Reply