Batch Processing DITA Files
I was looking for a flexible way to deliver an unspecified number of variations for the same help material. I didn't relish maintaining that many project files or trying to figure out how to run them. It was an interesting challenge. Someone asked about using variables in the ant files on the dita list, but that wouldn't have worked for me anyway.I resorted to batch files and ant's overrides. The ditamaps were, of course, generated. :-)
Check out: Apache Ant Demystified - parts 1 and 2
Here's an example:
______Batch_____
:: @echo off
:: Copyright 2007 Judy Newell
:: 1. identify the directory where the ditamap files are (input).
:: 2. identify the location of the ant file (antloc).
::
:: ant -f empathica_xhtml -Dargs.input=ditamap -Doutput.dir=output/client
:: If directories are not specified in the command line, use the test directories
SET input=c:\ditamaps
SET antloc=c:\project\ant
:: set commandline input and antloc parameters in variables
IF NOT (%1)==() SET input=%1
IF NOT (%2)==() SET antloc=%2
set old=%cd%
cd %antloc%
FOR %%I IN (%input%\*.ditamap) DO ant -f project_xhtml.xml -Dargs.input="%%I" -Dargs.xhtml.toc=%%~nI_index
cd %old%
:eof
_____Batch_____
More overrides...
FOR %%F IN (%input%\*.ditamap) DO ant -f project_index.xml -Dargs.input="%%F" -Doutput.dir=output\%%~nF\ -Doutput.file=%%~nF_indextermlist.html
Regards,
Judy

<< Home