Access user parameters in your Ant conductor file

To access the Generate Output dialog values in your Ant conductor file, you need to specify the MadCap Software default_dependencies target as a dependency of your target.

To access the property value, use the Ant standard "{outgen.job.userparam.property_name}" expression in your code, where property_name is the name of the user property defined in the preprocessors.xml file.

To access user parameters in your Ant conductor file:

  1. Open the conductor file (for example, %OutputGenDir%/data/conductor-acme.xml) with a text editor.
  2. Find the target for the applicable preprocessor.

    For example, to access the values entered by the user in the dialog shown in Figure 1, look for the acme.dita2xHtmlwrapper target, as shown below:

    <target name="acme.dita2xHtmlwrapper" depends="">
  3. If it is not already there, add the default_dependencies target to the dependencies; for example:
    <target name="acme.dita2xHtmlwrapper"  depends="default_dependencies">

    You will now be able to access the values entered by users in the Generate Output dialog.

  4. To access the property value, use the Ant standard "{outgen.job.userparam.property_name}" expression in your code, where property_name is the name of the user property defined in the preprocessors.xml file.
    For example, consider the following user parameters defined in the preprocessors.xml file for the acme.dita2xHTML preprocessor:
    <preprocessor 
          name="acme.dita2xHTML" 
          class="com.ixiasoft.outputgenerator.preprocessor.AntProcessor">
       <parameters>
          <system>
             <parameter name="buildfile" value="/conductor-acme.xml" />  
             <parameter name="target" value="acme.dita2xHtmlwrapper" />
             <parameter name="clean" value="job_postprocess" /> 
          </system>  
          <user>
             <parameter label="Document Identifier" name="doc.id" 
                        mandatory="true" type="string"/>
             <parameter label="Available to:" name="classification" 
                        mandatory="true" type="choice">
                        <value name="Public" default="true">Public</value>
                        <value name="Partner">Partner Only</value>
                        <value name="Internal">Acme Internal</value>
             </parameter>
             <parameter label="Publication Date" name="doc.pubdate" 
                        mandatory="true" type="date" format="YYYY-MM-DD"/>
         </user>     
       </parameters>
    </preprocessor> 

    To access these user parameters, add the default_dependencies target to the acme.dita2xHtmlwrapper target in the conductor-acme.xml file and add code similar to the following:

    <target name="acme.dita2xHtmlwrapper" depends="default_dependencies, flatten, resolve_container_keyref, extract_LowRes_images">
    	<echostart>acme.dita2xHtmlwrapper</echostart>
    
    	...
    
    	<!-- You can specify additional paramters using the macro "ot_build_set_parameter" -->
    	<!-- You must specify the OT parameter "transtype" -->
    	<ot_build_set_parameter name="transtype" value="xhtml"/>
    	<ot_build_set_parameter name="retain.topic.fo" value="yes"/>
    	<ot_build_set_parameter name="doc.id" value="${outgen.job.userparam.doc.id}"/>
    	<ot_build_set_parameter name="classification" value="${outgen.job.userparam.classification}"/>
    	<ot_build_set_parameter name="doc.pubdate" value="${outgen.job.userparam.doc.pubdate}"/>
    
    
    	...
    
    	<echoend>acme.dita2xHtmlwrapper</echoend>
    </target>
  5. Save and close the conductor file.