<?xml version="1.0"?>
<!--
  - Author:  Frederick Hirsch
  -->
<project name="testcases" default="testcases-xinclude-html">
  <description>
            This Ant build.xml file is used to transform xmlSig-InteropDoc.xml to testcases.html
    </description>

  <!--
	<target name="testcases-html" 
	        description="Generates HTML file from XML">
	  <xslt style="xmlspec+authors+edNotes.xsl"
	    in="xmlSig-InteropDoc.xml" out="testcases.html">
	  </xslt>
	</target>
  -->

  <!-- 
	    ANT Task for JAVA supporting XInclude
	    
	    based on posting based by David Le Strat
	    
	    http://dlsthoughts.blogspot.com/2005/08/xml-and-xsl-reuse-leveraging-xml.html#links    
	    
	    To get it running:
	    * download Xalan 2.7.0 OR or higher form
	        http://www.apache.org/dyn/closer.cgi/xml/xalan-j
	        
	    * set the following property to your xerxes xalan libs greater 2.7.0
	    
	    * use it with jdk 1.5 or above (so you will not get in trouble with java's xalan)
	    
	    * enjoy
    -->

  <property name="xerces-xalan-dir" value="../../_lib/" />

  <target name="testcases-xinclude-html" description="Generates HTML file from XML">
    <java classname="org.apache.xalan.xslt.Process" fork="true" dir=".">
      <jvmarg value="-Djavax.xml.parsers.DocumentBuilderFactory=org.apache.xerces.jaxp.DocumentBuilderFactoryImpl" />
      <jvmarg value="-Djavax.xml.parsers.SAXParserFactory=org.apache.xerces.jaxp.SAXParserFactoryImpl" />
      <jvmarg value="-Dorg.apache.xerces.xni.parser.XMLParserConfiguration=org.apache.xerces.parsers.XIncludeParserConfiguration" />
      <sysproperty key="jaxp.debug" value="1" />
      <arg value="-IN" />
      <arg value="xmlSig-InteropDoc.xml" />
      <arg value="-XSL" />
      <arg value="bibsort.xsl" />
      <arg value="-OUT" />
      <arg value="~testcases.xml" />
      <classpath>
        <path id="xerces-xalan-path">
          <fileset dir="${xerces-xalan-dir}" includes="**/*.jar" />
        </path>
      </classpath>
    </java>
    <java classname="org.apache.xalan.xslt.Process" fork="true" dir=".">
      <jvmarg value="-Djavax.xml.parsers.DocumentBuilderFactory=org.apache.xerces.jaxp.DocumentBuilderFactoryImpl" />
      <jvmarg value="-Djavax.xml.parsers.SAXParserFactory=org.apache.xerces.jaxp.SAXParserFactoryImpl" />
      <jvmarg value="-Dorg.apache.xerces.xni.parser.XMLParserConfiguration=org.apache.xerces.parsers.XIncludeParserConfiguration" />
      <sysproperty key="jaxp.debug" value="1" />
      <arg value="-IN" />
      <arg value="~testcases.xml" />
      <arg value="-XSL" />
      <arg value="xmlspec.xsl" />
      <arg value="-OUT" />
      <arg value="~testcases.html" />
      <arg value="-HTML" />
      <classpath>
        <path id="xerces-xalan-path">
          <fileset dir="${xerces-xalan-dir}" includes="**/*.jar" />
        </path>
      </classpath>
    </java>
    <exec executable="tidy">
      <arg value="-m"/>
      <arg value="-i"/>
      <arg value="-asxhtml"/>
      <arg value="-raw"/>
      <arg value="-utf8"/>
      <arg value="~testcases.html"/>
    </exec>
    <exec executable="perl" output="testcases.html">
      <arg value="fmtxml.pl"/>
      <arg value="~testcases.html"/>
    </exec>
  </target>

  <target name="testcases-zip" description="Generates a ZIP File from all the testcases and results">
    <delete file="XMLSec-Maintenance-WG-Interop-200709.zip" failonerror="false"/>
    <zip destfile="XMLSec-Maintenance-WG-Interop-200709.zip">
      <fileset dir="./">
        <include name="testcases.html" />
      </fileset>
      <fileset dir="../">
        <include name="c14n11/**/*" />
        <include name="xmldsig/**/*" />
      </fileset>
    </zip>
  </target>
  
</project>

