Customizing the QA Plugin
The qa_for_ot target is a target that calls the
DITA-OT to execute a transformation (in this case, with the qa
transtype that is defined by the QA Plugin), but you can use
existing Ant tasks to customize this target as necessary.
For example, you can modify the source files before sending them to the DITA-OT or modify the output before sending it back to the end user.
Modifying the source files before sending it to the OT
The QA Plugin documentation recommends that the map has the
chunk=”to-content”
property set so that the QA report is returned
in a single file (otherwise, the plugin will return one report per topic). To set this
attribute, add the following lines to the target before copying the source files to the output
directory:<xmltask source="${outgen.job.source.filename}" dest="${outgen.job.source.filename}"
preservetype="true">
<xmlcatalog refid="ot.catalog"/>
<attr path="/*[contains(@class, ' map/map ')]" attr="chunk" value="to-content"/>
</xmltask>
Modifying the output before sending it to the end user
The output returned by the DITA-OT contains links
with absolute paths; for
example:
<a href="file:///C:\ixiasoft\OutputGenerators\Prod\temp\ QA_for_OT.larochen.29.1415885502592\content\authoring\lar1401392173432.xml
These links will not work on the end-user system. To change these links to
relative paths before returning the output to the user, add the following lines before the end
of the
target:
<replace file="${outgen.job.output.dir}/${outgen.job.sourcefile.name.noext}.html"
token="file:///${outgen.job.dir}${file.separator}" value=""/>
<replace file="${outgen.job.output.dir}/${outgen.job.sourcefile.name.noext}.html"
token="${outgen.job.dir}${file.separator}" value=""/>
The final output would look as
follows:
<target name="qa.report" depends="default_dependencies, flatten, resolve_container_keyref, extract_HiRes_images">
<echostart>qa.report</echostart>
<xmltask source="${outgen.job.source.filename}" dest="${outgen.job.source.filename}"
preservetype="true">
<xmlcatalog refid="ot.catalog"/>
<attr path="/*[contains(@class, ' map/map ')]" attr="chunk" value="to-content"/>
</xmltask>
<property name="outgen.job.build.filename" location="${outgen.job.dir}/build.xml"/>
<property name="outgen.job.build.template.filename"
location="${outgen.resources.dir}/job-build-template.xml"/>
<property name="outgen.job.build.otlog.filename"
location="${outgen.job.ot.log.dir}/${outgen.job.source.name.noext}.ot.log"/>
<antcall target="ot_build_create"/>
<antcall target="ot_build_add_ditaval_ifpresent"/>
<antcall target="ot_build_clean_ot_temp"/>
<update-ot-build-file buildfile="${outgen.job.build.filename}">
<param name="transtype" value="qa"/>
</update-ot-build-file>
<antcall target="dita_startcmd_ot_build"/>
<antcall target="clean_ot_output"/>
<!-- Set the property job.keep.temp to preserve the completed temp folder of the task -->
<!--<property name="job.keep.temp" value="yes"/>-->
<!-- Modify the output before sending it to the user -->
<replace file="${outgen.job.output.dir}/${outgen.job.source.name.noext}.html"
token="file:///${outgen.job.dir}${file.separator}" value=""/>
<replace file="${outgen.job.output.dir}/${outgen.job.source.name.noext}.html"
token="${outgen.job.dir}${file.separator}" value=""/>
<echoend>qa.report</echoend>
</target>