Generate single html from the ditamap

Questions about XML that are not covered by the other forums should go here.
altein
Posts: 13
Joined: Mon Jan 18, 2010 4:32 pm

Generate single html from the ditamap

Post by altein »

Hi,
I noticed that when using the XHTML transformation, each topic is output in its own file. Is there a way of including a toc in every html file (i.e., in its own <div> element)?

Thanks,
Allan
Radu
Posts: 9057
Joined: Fri Jul 09, 2004 5:18 pm

Re: Generate single html from the ditamap

Post by Radu »

Hi Allan,

I don't quite understand your question.
From the subject I understand that you want to generate a single XHTML document (similar to the PDF output but in the XHTML form) from the DITA project.
From the topic body I understand that you want to include a table of contents in each of the generated XHTML files.
Which one is it?

Regards,
Radu
Radu Coravu
<oXygen/> XML Editor
http://www.oxygenxml.com
altein
Posts: 13
Joined: Mon Jan 18, 2010 4:32 pm

Re: Generate single html from the ditamap

Post by altein »

I apologize for the unclarity.
I wanted to know if you could generate a single XHTML document
from the ditamap, like you do when you generate a .pdf file from the ditamap.

Thanks,
Allan
Radu
Posts: 9057
Joined: Fri Jul 09, 2004 5:18 pm

Re: Generate single html from the ditamap

Post by Radu »

Hi Allan,

There is not a builtin transformation in Oxygen which does that but there is a way:
1) Edit the OXYGEN_INSTALL_DIR\frameworks\dita\DITA-OT\demo\fo\build.xml file, find the target

Code: Select all

<target name="delete.fo2pdf.topic.fo" unless="retain.topic.fo">
and delete its entire content (leaving it empty). This will inhibit the DITA Open Toolkit from removing the output XSL:FO file once the PDF is constructed.

2) Run an IDIOM PDF transformation on the DITA Map.
After the transformation open in Oxygen the "topic.fo" file which will be created in the DITA transformation output folder.

3) There is a free XSLT stylesheet implementation which transforms from XSL:FO to XHTML. You can register on the RenderX website and download it:
http://www.renderx.com/tools/fo2html.html

4) Transform the FO file using the XSL stylesheet and saving the result as the HTML result.

Regards,
Radu
Radu Coravu
<oXygen/> XML Editor
http://www.oxygenxml.com
dagoss
Posts: 24
Joined: Fri Apr 05, 2013 11:01 pm

Re: Generate single html from the ditamap

Post by dagoss »

While this is an older topic, I just wanted to add a better solution to this in case anyone finds it while searching for the same problem.

You can use the chuck attribute on your map to generate a single HTML file for your content:

Code: Select all


<map id="foo" chunk="to-content">
<topicref href="test1.dita"/>
<topicref href="test2.dita"/>
<topicref href="test3.dita"/>
</map>
The TOC is still generated as a separate chunk, but your content will appear all on a single HTML page. Tested with Oxygen 15.2 and DITA-OT 1.7.
Radu
Posts: 9057
Joined: Fri Jul 09, 2004 5:18 pm

Re: Generate single html from the ditamap

Post by Radu »

Hi,

Thanks for updating this forum thread, your solution is the proper one.
I can only blame my suggested workaround at that time on the fact that back then I did not know much about DITA chunking.

Regards,
Radu
Radu Coravu
<oXygen/> XML Editor
http://www.oxygenxml.com
Post Reply