Creating folders based on chapter using DITA OT while transforming

41 views
Skip to first unread message

rahul...@gmail.com

unread,
Sep 1, 2021, 5:56:28 AM9/1/21
to DITA-OT Users
Hello developers,

I am transforming DITA to HTML5 using built in DITA OT html5 plugin. I am trying to create folders in the output based on the chapter names and move all associated html and images in the respective folders. Please guide me on this. 

Thanks in advance
Rahul



Toshihiko Makita

unread,
Sep 5, 2021, 9:43:22 PM9/5/21
to DITA-OT Users
You have posted the same question on Stackoverflow and I realized that you are using CCMS for DITA.
Generally speaking, the checkout result from CCMS exists in flat file system (under the one folder).
As a result making structured hierarchy from flat file system is hard because you must maintain xref/@href by yourself.
Jarno has pointed out that there is extension mechanism that preprocess2 can rewrite file names and locations.
But it is still unclear this mechanism guarantee the xref/@href rewrite or reltable references.

What is the main motivation for creating folders based on the chapter names?

Regards,
-- 
/*--------------------------------------------------
 Toshihiko Makita
 Development Group. Antenna House, Inc. Ina Branch
 Web site:
 http://www.antenna.co.jp/
 http://www.antennahouse.com/
 --------------------------------------------------*/   

2021年9月1日水曜日 18:56:28 UTC+9 rahul...@gmail.com:

Chris Papademetrious

unread,
Sep 8, 2021, 11:51:32 AM9/8/21
to DITA-OT Users
Hi Rahul, Toshihiko,

We might have to solve a similar problem in the future. We have multiple books that share common content in a _warehouse/ directory:

bookA.ditamap
bookB.ditamap
bookA/
  ...book A topics...
bookB/
  ...book B topics...
_warehouse/
  ...shared topics...

If we publish a top-level online help (OLH) map that includes these books:

<map>
  <title>Online Help</title>
  <mapref href="bookA.ditamap"/>
  <mapref href="bookB.ditamap"/>
</map>

then the URLs for shared topics will have "_warehouse" instead of "bookA" or "bookB" in them. To avoid confusion, we want all content associated with a map to be included in the directory named after the bookmap using the topic.

The file/directory-naming extension in preprocess2 is interesting, but I am not yet sure how I would determine which book uses the topic. (The "input map" being processed by the DITA-OT will be the OLH map, and the bookmaps will be intermediate maps within it.)

I might need to write a perl script that traces all the file dependency structure, then reorganizes the content directories by bookmap. Or maybe the metadata exists during the transformation that I might be able to figure it out. We haven't reached that point in our evaluation yet, so right now this is just some high-level thinking about the future, and I thought it might be interesting to you to share.

 - Chris

rahul...@gmail.com

unread,
Sep 9, 2021, 2:14:42 AM9/9/21
to DITA-OT Users
Hi All,

Thank you for your suggestions. This is a great learning for me.

Regards
Rahul

Reply all
Reply to author
Forward
0 new messages