Can the DocBook to DITA XML converter be customized?

Post here questions and problems related to editing and publishing DITA content.
davel
Posts: 1
Joined: Fri Oct 13, 2023 5:53 pm

Can the DocBook to DITA XML converter be customized?

Post by davel »

Hi there,
first-time poster here - apologies if what I'm asking might be obvious to more experienced posters.

I'm wondering if the DocBook to DITA converter can be customized? Right now the only option available is the 'Create DITA maps from DocBook documents containing multiple sections' option.

For example, is there any way to customize the converter's behavior so that it does not blindly create a topic for every set of '<section></section>' XML tags?

Here's the structure of the DocBook XML file that I'm importing:

<section version="5.0" role="original-topic"...><title>Topic A</title>
<para>Blah blah...</para>
<section role="internal"><title>Section B</title>
<para>Blah blah...</para>
<section role="internal"><title>Subsection C</title>
<para>Blah blah...</para>
</section>
</section>
</section>

After importing this to DITA via the converter, the following topics are created:
- A top-level topic, 'Topic A'.
- A subtopic of 'Topic A' called 'Section B'.
- A subtopic of 'Section B'' called 'Subsection C'.

Instead, I would like to see one topic created (called 'Topic A') that contains a section ('Section B') that in turn contains a sectiondiv ('Subsection C'). Can this kind of thing be done and, if so, how?
Cosmin Duna
Site Admin
Posts: 120
Joined: Wed Dec 12, 2018 5:33 pm

Re: Can the DocBook to DITA XML converter be customized?

Post by Cosmin Duna »

Hello,
Unfortunately, we don't have an option for configuring the extracted topics, and the conversion process aims to maintain the hierarchical structure rather than creating a flat document. I have raised an internal issue to explore the possibility of enhancing this configuration, but implementing such a feature may be challenging.

Regarding the 'sectiondiv' element, it doesn't allow a title. For making the structure flater, I suggest moving "Subsection C" as a section element within the Section B extracted topic, thus preserving the hierarchy.

To make these manual changes efficiently, you can convert the DocBook document into a DITA Composite. To do this, uncheck the 'Create DITA maps from DocBook documents containing multiple sections' option. Then, change the topics you wish to include within other topics as sections and place them inside the body of the parent topic.

Afterwards, create a DITA map, insert a topic reference to the resulting document, and use the "Convert Nested Topics to New Topics" refactoring operation (you can find details on this operation here: link). for extracting the topics. You can then use a drag-and-drop method to place the extracted topics on the top level and remove the empty DITA Composite.

Best regards,
Cosmin
Cosmin Duna
<oXygen/> XML Editor
http://www.oxygenxml.com
Post Reply