Search code examples
xmldocumentationxml-documentationdita

How to combine DITA topics AND have nested topics in HTML output?


This is similar to a previous question that I asked, with one variation. I would like to know how to merge multiple topics into one (using @chunk) and then have other child topics that can be navigated to in the HTML output:

Real-world example: http://docs.autodesk.com/3DSMAX/15/ENU/3ds-Max-Help/files/GUID-484B095B-1229-4CB9-BC53-952AC40F67C2.htm

  • At the top of the document you will notice that multiple topics have been combined into one. These topics include concept and task types.
  • Towards the bottom of the document you will see that you can navigate to child topics.

Despite many efforts I cannot get the nested topics to remain individual. They either merge with topic1+topic2+topic3 or they disappear from TOC altogether.

Given that there are 7 individual topics of assorted types, I would like to write a map that produces the following HTML output:

  • topic1+topic2+topic3
    • topic4
    • topic5
      • topic6
  • topic 7

Solution

  • Okay, after a lot of tinkering I have found that the following generates the desired output:

    <!-- chapter.ditamap -->
    <topicref href="objects/overview.dita" type="concept" chunk="to-content">
        <!-- topics to combine with parent -->
        <topicref href="objects/visualising-objects.dita" type="concept"/>
    
        <!-- changing-the-object-size.dita = nested topic -->
        <topicref href="changing-the-object-size.dita" type="task" chunk="to-content"/>
    </topicref>
    

    or another slightly cleaner markup (imo):

    <!-- chapter.ditamap -->
    <topicref href="objects/overview.dita" type="concept" chunk="to-content">
        <!-- topics to combine with parent -->
        <topicref href="objects/visualising-objects.dita" type="concept"/>
    
        <!-- changing-the-object-size.dita = nested topic -->
        <topicgroup>
            <topicref href="changing-the-object-size.dita" type="task" chunk="to-content"/>
        </topicgroup>
    </topicref>
    

    This generates 2 HTML files, one for "Overview + Visualising Objects" and another for "Changing the Object Size" which is nested within "Overview + Visualising Objects".

    Unfortunately I cannot place the combined topic into its own separate map:

    <!-- chapter.ditamap -->
    <!-- objects.ditamap = combined topic -->
    <topicref href="objects.ditamap" type="dita">
        <!-- changing-the-object-size.dita = nested topic -->
        <topicref href="changing-the-object-size.dita" type="task"/>
    </topicref>
    

    (any ideas guys?)

    But, at least I have found a solution!