<?xml version="1.0" encoding="UTF-8"?>
<!-- This file is part of the DITA Open Toolkit project hosted on 
     Sourceforge.net. See the accompanying license.txt file for 
     applicable licenses.-->
<!-- (c) Copyright IBM Corp. 2006 All Rights Reserved. -->
<project name="dita2docbook">

  <target name="dita2docbook"
    depends="build-init, preprocess, topic2docbook, map2docbook">
  </target>

  <target name="topic2docbook" if="noMap">
    <antcall target="dita.topic.docbook">
      <param name="inputFile"
        value="${dita.temp.dir}${file.separator}${user.input.file}" />
      <param name="outputFile"
        value="${dita.map.output.dir}${file.separator}${dita.topic.filename.root}.xml" />
    </antcall>
  </target>

  <target name="map2docbook" unless="noMap">
    <antcall target="dita.map.docbook">
      <param name="mapRoot" value="${dita.map.filename.root}" />
      <param name="inputMap" value="${user.input.file}" />
      <param name="inputDir" value="${dita.temp.dir}" />
      <param name="outputDir" value="${dita.map.output.dir}" />
    </antcall>
  </target>

  <!-- Build DocBook output from ditamap -->
  <target name="dita.map.docbook"
    description="Build DocBook output from ditamap">
    <condition property="args.xsl"
      value="${dita.script.dir}${file.separator}map2docbook.xsl">
      <not>
        <isset property="args.xsl" />
      </not>
    </condition>
    <mkdir dir="${outputDir}" />
    <xslt processor="trax" in="${inputDir}${file.separator}${inputMap}"
      out="${outputDir}${file.separator}${mapRoot}.xml"
      classpathref="dost.class.path"
      style="${args.xsl}">
      <param name="outputdir" expression="${outputDir}" />
      <xmlcatalog refid="dita.catalog"/>
    </xslt>
  </target>

  <!-- Build DocBook output from dita topic -->
  <target name="dita.topic.docbook"
    description="Build DocBook output from dita topic">
    <condition property="args.xsl"
      value="${dita.script.dir}${file.separator}dita2docbook.xsl">
      <not>
        <isset property="args.xsl" />
      </not>
    </condition>
    <xslt processor="trax" in="${inputFile}" out="${outputFile}"
      classpathref="dost.class.path"
      style="${args.xsl}">
      <xmlcatalog refid="dita.catalog"/>
    </xslt>
  </target>
</project>
