<project name="XOM documentation" default="all" basedir=".">
  <description>
    Run stylesheets across DocBook source code
  </description>
    
  <!-- set global properties for this build -->
  <property name="build.dir"  value="./build"/>
  <property name="build.dest" value="${build.dir}/website"/>
  <property name="parentdist.dir"   value="../dist/website"/>

  <path id="xslt.class.path">
    <pathelement path="/opt/xml/saxon/saxon.jar"/>
    <pathelement path="../lib/xalan.jar"/>
  </path>

  <path id="xerces.class.path">
     <pathelement path="../lib/dtd-xercesImpl.jar"/> 
     <pathelement path="../lib/xmlParserAPIs.jar"/> 
  </path>
  
  <target name="init">
    <!-- Create the time stamp -->
    <tstamp/>

    <mkdir dir="${build.dest}"/>
    <mkdir dir="${parentdist.dir}"/>
  </target>

  <target name="finished_tutorial.xml" depends="init"
          description="Merge original chapters and examples into a single file">
    <java classname="nu.xom.samples.XIncludeDriver" output="${build.dir}/finished_tutorial.xml" fork="yes" failonerror="true">
        <arg line="tutorial.xml"/>
        <classpath refid="xerces.class.path"/>
        <classpath location="../build/classes"/>
        <classpath location="../build/jaxen-classes"/>
     </java>
  </target>

  
  <target name="valid" 
          description="Check validity of input documents and output"
          depends="tutorial">
    <java classname="nu.xom.samples.Validator">
     <arg value="index.html"/>
     <arg value="faq.xml"/>
     <arg value="${build.dir}/finished_tutorial.xml"/>
     <arg value="${build.dest}/tutorial.xhtml"/>
     <arg value="infoset.xml"/>
     <arg value="xpath.xml"/>
     <arg value="license.xml"/>
     <arg value="openquestions.xml"/>
     <arg value="futuredirections.xml"/>
     <arg value="testsuite.xml"/>
     <arg value="faq.xml"/>
     <arg value="designprinciples.xml"/>
	
     <classpath refid="xerces.class.path"/>
     <classpath location="../build/classes"/>
     <classpath location="../build/jaxen-classes"/>
    </java>
  </target>


  <target name="tutorial" description="Generate a single XHTML document" depends="finished_tutorial.xml">
    <java classname="com.icl.saxon.StyleSheet" output="${build.dest}/tutorial.xhtml"  fork="yes" error="${build.dir}/error.txt" failonerror="true">
        <arg line="${build.dir}/finished_tutorial.xml"/>
        <arg line="tutorial.xsl"/>
        <!-- <arg line="/opt/xml/docbook-xsl/xhtml/docbook.xsl"/> -->
        <classpath refid="xerces.class.path"/>
        <classpath refid="xslt.class.path"/>
     </java>
  </target>	 

  <target name="design" depends="init" description="Design principles">
    <java classname="com.icl.saxon.StyleSheet" output="${build.dest}/designprinciples.xhtml" fork="yes" error="${build.dir}/error.txt" failonerror="true">
        <arg line="designprinciples.xml"/>
        <arg line="/opt/xml/docbook-xsl/xhtml/docbook.xsl"/>
        <classpath refid="xerces.class.path"/>
        <classpath refid="xslt.class.path"/>
     </java>
  </target>	 

  <target name="license" depends="init" description="License for XOM">
    <java classname="com.icl.saxon.StyleSheet" output="${build.dest}/license.xhtml" fork="yes" error="${build.dir}/error.txt" failonerror="true">
        <arg line="license.xml"/>
        <arg line="/opt/xml/docbook-xsl/xhtml/docbook.xsl"/>
        <classpath refid="xerces.class.path"/>
        <classpath refid="xslt.class.path"/>
     </java>
  </target>	 

 <target name="infoset" depends="init" description="Infoset Mapping">
    <java classname="com.icl.saxon.StyleSheet" output="${build.dest}/infoset.xhtml" fork="yes"  error="${build.dir}/error.txt" failonerror="true">
        <arg line="infoset.xml"/>
        <arg line="/opt/xml/docbook-xsl/xhtml/docbook.xsl"/>
        <classpath refid="xerces.class.path"/>
        <classpath refid="xslt.class.path"/>
     </java>
  </target>	 

 <target name="xpath" depends="init" description="XPath Mapping">
    <java classname="com.icl.saxon.StyleSheet" output="${build.dest}/xpath.xhtml"  fork="yes" error="${build.dir}/error.txt" failonerror="true">
        <arg line="xpath.xml"/>
        <arg line="/opt/xml/docbook-xsl/xhtml/docbook.xsl"/>
        <classpath refid="xerces.class.path"/>
        <classpath refid="xslt.class.path"/>
     </java>
  </target>	 

  <target name="faq" depends="init" description="FAQ list for XOM">
    <java classname="com.icl.saxon.StyleSheet" output="${build.dest}/faq.xhtml"  fork="yes" error="${build.dir}/error.txt" failonerror="true">
        <arg line="faq.xml"/>
        <arg line="/opt/xml/docbook-xsl/xhtml/docbook.xsl"/>
        <classpath refid="xerces.class.path"/>
        <classpath refid="xslt.class.path"/>
     </java>
  </target>	 

  <target name="open" depends="init" description="Open Questions list for XOM">
    <java classname="com.icl.saxon.StyleSheet" output="${build.dest}/openquestions.xhtml" fork="yes" error="${build.dir}/error.txt" failonerror="true">
        <arg line="openquestions.xml"/>
        <arg line="/opt/xml/docbook-xsl/xhtml/docbook.xsl"/>
        <classpath refid="xerces.class.path"/>
        <classpath refid="xslt.class.path"/>
     </java>
  </target>	 

  <target name="future" depends="init" description="Future Directions for XOM">
    <java classname="com.icl.saxon.StyleSheet" output="${build.dest}/futuredirections.xhtml" fork="yes" error="${build.dir}/error.txt" failonerror="true">
        <arg line="futuredirections.xml"/>
        <arg line="/opt/xml/docbook-xsl/xhtml/docbook.xsl"/>
        <classpath refid="xerces.class.path"/>
        <classpath refid="xslt.class.path"/>
     </java>
  </target>	 


  <target name="building" depends="init" description="How to build XOM">
    <java classname="com.icl.saxon.StyleSheet" output="${build.dest}/building.xhtml"  fork="yes" error="${build.dir}/error.txt" failonerror="true">
        <arg line="building.xml"/>
        <arg line="/opt/xml/docbook-xsl/xhtml/docbook.xsl"/>
        <classpath refid="xerces.class.path"/>
        <classpath refid="xslt.class.path"/>
     </java>
  </target>	 


  <target name="install" depends="init" description="How to install XOM">
    <java classname="com.icl.saxon.StyleSheet" output="${build.dest}/install.xhtml" fork="yes"  error="${build.dir}/error.txt" failonerror="true">
        <arg line="install.xml"/>
        <arg line="/opt/xml/docbook-xsl/xhtml/docbook.xsl"/>
        <classpath refid="xerces.class.path"/>
        <classpath refid="xslt.class.path"/>
     </java>
  </target>	 


  <target name="testsuite" depends="init" description="How to test XOM">
    <java classname="com.icl.saxon.StyleSheet" output="${build.dest}/testsuite.xhtml"  fork="yes" error="${build.dir}/error.txt" failonerror="true">
        <arg line="testsuite.xml"/>
        <arg line="/opt/xml/docbook-xsl/xhtml/docbook.xsl"/>
        <classpath refid="xerces.class.path"/>
        <classpath refid="xslt.class.path"/>
     </java>
  </target>	 


  <target name="samples" depends="init" description="Example code">
    <java classname="com.icl.saxon.StyleSheet" output="${build.dest}/samples.xhtml"  fork="yes" error="${build.dir}/error.txt" failonerror="true">
        <arg line="samples.xml"/>
        <arg line="/opt/xml/docbook-xsl/xhtml/docbook.xsl"/>
        <classpath refid="xerces.class.path"/>
        <classpath refid="xslt.class.path"/>
     </java>
  </target>


  <target name="html" depends="init" description="Raw HTML files that don't need to be transformed">
    <copy todir="${build.dest}">
      <fileset dir=".">
        <include name="*.html"/>
        <include name="*.txt"/>
      </fileset>
    </copy>
  </target>	


  <target name="dist" depends="html, tutorial, faq, infoset, xpath, design, future, open, license, testsuite, samples, install, building">
    <copy todir="${parentdist.dir}" >  
      <fileset dir="${build.dest}" includes="**"/>  
    </copy> 
    <copy todir="${parentdist.dir}/WEB-INF" >  
      <fileset dir="WEB-INF" includes="**"/>  
    </copy>
    <copy todir="${parentdist.dir}/whatswrong" >  
      <fileset dir="whatswrong" includes="**"/>  
    </copy>
  </target>

  <target name="clean" depends="init" description="Remove build files">
    <delete dir="${build.dir}"/>
    <delete dir="${dist.dir}"/>
  </target>
</project>

