DITA Tip—Where to Put Your Files

If you are using the DITA Open Toolkit to process your DITA sources, I strongly recommend that you put your source files in a folder under the OT. For example, if you have installed the Toolkit in C:\DITA-OT1.2.2, put your source files in C:\DITA-OT1.2.2\mystuff.

This makes it a lot easier to use Ant to generate your output.

For example, let’s say all your source files are in C:\DITA-OT1.2.2\mystuff, and you want the map file called mymap.ditamap to be processed and the output placed in C:\DITA-OT1.2.2\mystuff\out.

Just add this target to build.xml:

<target name="mymap" depends="use-init">
	<antcall target="dita2xhtml">
		<param name="args.input" value="mystuff${file.separator}mymap.ditamap"/>
		<param name="output.dir" value="mystuff${file.separator}out"/>
		<param name="args.xhtml.toc" value="toc"/>
		<param name="transtype" value="xhtml"/>
	</antcall>
	<copy todir="mystuff${file.separator}out">
		<fileset dir="${dita.resource.dir}" includes="index.html"/>
	</copy>
</target>

Then just type ant mymap at the command line and away you go!

Or if you want a really easy life, just use ant prompt. That way you don’t need to get you hands dirty fiddling with build.xml at all.