Setting Up to Use the Generate Output Command

Details on setting up DITA-FMx to communicate with the DITA Open Toolkit.

The Generate Output command lets you generate output through the DITA Open Toolkit. This command provides two main options: generate output from the current topic or map, or by using a specific Ant target. The setup required for these two options is described below.

DITA-FMx makes a call to the DITA Open Toolkit (DITA-OT) through a batch file named ~ant-build.cmd. This file is generated in the user’s DITA-FMx folder (use the Open DITA-FMx Folder command). In order for this batch file to work properly, the environment variables that define the location of Java and Ant (and possibly other utilities) must be properly defined.

The DITA-OT Directory and the DITA-OT Environment Setup File fields in the External Application Settings dialog must be specified to load the proper environment settings when the DITA-OT is run. If you’re using a current version of the DITA-OT and follow the instructions below, setup should be fairly simple. However, if you use an older version of the OT or have special requirements you may need to ensure that the environment settings are defined globally.

If you are using DITA-OT 1.4.1 or later, we have found that you must use Java 1.5 or higher. We recommend that you use the “fullpackage” version of the DITA-OT.

Complete the following steps to ensure that you are able to generate output through the Open Toolkit:

  1. Download the latest “full” ZIP of the DITA-OT from SourceForge <sourceforge.net/projects/dita-ot/>. Extract the contents of this file to your local file system into a directory named C:\DITA (or similar). It is a good practice to ensure that the path to the DITA-OT directory has no spaces in any of the directory names. After extracting the contents of the OT archive, you will have a path such as C:\DITA\DITA-OT1.8.4.
  2. Download and install the Java Development Kit (JDK) version 5 or higher (www.oracle.com/technetwork/java/javase/downloads).
  3. Set your JAVA_HOME environment variable to the path of the newly installed JDK (perhaps "C:\Program Files\Java\jdk1.6.0_04").
  4. Copy the ditafmx-ant.xml file from the Program Files\Adobe\FrameMaker\DITA-FMx-2 folder to your DITA-OT folder.
  5. In the DITA-OT folder, copy the startcmd.bat file to ditafmx-startcmd.bat (in the same folder copy the file to a new name).
  6. Open the ditafmx-startcmd.bat file in Notepad (or other text editor) and comment out the last line (add a “REM” at the start of the line). If you don't comment out this line, it will still work, you'll just get an empty shell that hangs around each time you build. It should look like this:
    REM start "DITA-OT" cmd.exe
  7. In the DITA Options dialog, select the External Apps button to display the External Application Settings dialog. Set the value of the DITA-OT Directory option to reference the main DITA-OT directory. Then set the value of the DITA-OT Environment Setup File option to reference the ditafmx-startcmd.bat file.

    If you make use of the Selected Target option with the Generate Output command in Frame, by default this environment setup file is used for those builds as well. If you want to specify an alternate environment setup file, you can add the “EnvironmentSetup” parameter to the associated "ANT:<targetname>" sections.

This should let you generate output through the default OT 1.5.4 targets, without requiring you to set up the system environment. If you use the PDF2 transform, you may need to do some additional work such as starting Frame from a shell in the OT directory (or adding a "cd %DITA_DIR%" line to the ditafmx-startcmd.bat file.

Alternatively, you may want to start FM from the DITA-OT directory. To do this just create a shortcut to FrameMaker.exe, and in the "Start In" field of the Shortcut tab, set this value to the path to your DITA-OT directory.

Generate Output: Current File Option

The Current File option of the Generate Output command lets you generate output from the current topic or map file using a pre-defined Ant script (ditafmx-ant.xml). The installation process described above should be all that’s needed to use this command.

The information about the current file and project are passed to the Ant script through command line parameters. Initially this provides support for 11 targets. If you want to add others, modify the ditafmx-ant.xml file and add more targets to the BuildFile section of the ditafmx.ini file. The following is the default BuildFile section after completing the basic setup:

[BuildFile] 
AntCommand=ant 
EnvironmentSetup=C:\DITA\DITA-OT1.8.4\ditafmx-startcmd.bat 
DitaDir=C:\DITA\DITA-OT1.8.4\ 
AntScript=ditafmx-ant.xml 
Count=11 
1=xhtml 
2=chm 
3=pdf 
4=eclipsehelp 
5=javahelp 
6=docbook 
7=eclipsecontent 
8=troff 
9=wordrtf 
10=epub-out 
11=suitehelp

Each of the numbered entries corresponds to target defined in the ditafmx-ant.xml file. If you want to add additional targets, add it to the ditafmx-ant.xml file, then add the corresponding target name to the BuildFile section (don’t forget to update the Count parameter).

If you need to use a different DITA-OT installation for a specific build target, add new entries for EnvironmentSetup-<target> and DitaDir-<target>. For example, if the “chm” target required the use of a specially set up DITA-OT installation, you might use the following:

[BuildFile] 
AntCommand=ant 
EnvironmentSetup=C:\DITA\DITA-OT1.8.4\ditafmx-startcmd.bat 
DitaDir=C:\DITA\DITA-OT1.8.4\ 
EnvironmentSetup-chm=C:\DITA\DITA-OT1.8.4-CHM\ditafmx-startcmd.bat 
DitaDir-chm=C:\DITA\DITA-OT1.8.4-CHM\ 
AntScript=ditafmx-ant.xml 
Count=11 
1=xhtml 
2=chm 
3=pdf 
4=eclipsehelp 
5=javahelp 
6=docbook 
7=eclipsecontent 
8=troff 
9=wordrtf 
10=epub-out 
11=suitehelp

The “lmi-airhelp” target is included in the ditafmx-ant.xml file. If you would like to try building AIR Help from DITA files, download the DITA to AIR Help plugin from Leximation at www.leximation.com/airhelp/. You will also need to add an “lmi-airhelp” entry to the BuildFile section of the ditafmx.ini file.

In order to take advantage of ditaval filtering, you must register or create ditaval files so they are known to DITA-FMx. The Ditaval Manager provides the means to add existing files, or create new files.

Generate Output: Selected Target Option

The following steps should get you up and running with the Selected Target option of the Generate Output command.

  1. Copy the PROJECT.xml file to your DITA-OT directory and rename it something appropriate for your project.

  2. Edit the <project>.xml file and set the properties indicated in the comments so they match your system and project.

  3. Set up the ditafmx.ini file as follows:

    notes:
    • Be sure that the LogFile parameter specifies a directory that exists before the Ant script is run, otherwise the build will fail.

    • The optional EnvironmentSetup parameter can be used to specify a batch file to run before running the Ant script in order to set up the environment. (If this is not added, the default setting in the BuildFile section will be used.)

    • In the examples below, swap “<PROJECT>” for the actual project name.

    • If the builds aren't working, try running the script from the command line: ant -f project.xml html

    [AntBuild] 
    Count=3 
    1=<PROJECT> - CHM 
    2=<PROJECT> - HTML 
    3=<PROJECT> - PDF 
     
    [ANT:<PROJECT> - CHM] 
    BuildFile=C:\DITA-OT1.5.4\<PROJECT>.xml 
    EnvironmentSetup=C:\DITA-OT1.5.4\ditafmx-startcmd.bat 
    Target=chm 
    OutputDir=C:\Projects\<PROJECT>\out\chm 
    Logfile=C:\Projects\<PROJECT>\ant-buildlog-chm.txt 
     
    [ANT:<PROJECT> - HTML] 
    BuildFile=C:\DITA-OT1.5.4\<PROJECT>.xml 
    EnvironmentSetup=C:\DITA-OT1.5.4\ditafmx-startcmd.bat 
    Target=html 
    OutputDir=C:\Projects\<PROJECT>\out\html 
    Logfile=C:\Projects\<PROJECT>\ant-buildlog-html.txt 
     
    [ANT:<PROJECT> - PDF] 
    BuildFile=C:\DITA-OT1.5.4\<PROJECT>.xml 
    EnvironmentSetup=C:\DITA-OT1.5.4\ditafmx-startcmd.bat 
    Target=pdf 
    OutputDir=C:\Projects\<PROJECT>\out\pdf 
    Logfile=C:\Projects\<PROJECT>\ant-buildlog-pdf.txt