Normalized DITA : split topics into separate files?

148 Views Asked by At

I'm following the DITA Open-Toolkit 3.5 documentation to generate normalized DITA from lightweight/markdown input.

How can I split up the output - so that I get one file-per-topic? Here's my input markdown ("test.md"):

# My Document

This is my document

# Header One

This is some text.

- One
- Two
- Three

# Header Two

This is some text for the Topic called 'Header Two'.
Another bit of text here.

- Item 1
- Item 2
- Item 3

And my map file ("map.dita"):

<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE map PUBLIC "-//OASIS//DTD DITA Map//EN" "map.dtd">
<map>
  <topicref href="test.md" format="markdown"/>
</map>

And the command I'm using:

$ dita --input=map.dita --format=dita

And dita version:

$ dita -version
DITA-OT version 3.5.3

The manual talks about plugins - but I'm not sure whether these need to be specially written in java - or whether this could be achieved with XSLT? (or config etc)

1

There are 1 best solutions below

0
On

The DITA normalize plugin resides in "DITA-OT/plugins/org.dita.normalize" and it has an XSLT stylesheet which generates a DITA topic "org.dita.normalize/xsl/normalize.xsl". Maybe you can modify that XSLT stylesheet and use an xsl:result-document to create separate files for the inner topics. I also made this video about 2 years ago for the DITA Open Toolkit Day which details how a DITA OT plugin can be implemented, maybe it's useful for you to know what a plugin is in general and what it can do: https://www.oxygenxml.com/events/2018/dita-ot_day.html#step_by_step_implementation_of_a_DITA