<?xml version="1.0" encoding="utf-8"?>
<project basedir="." default="dist" name="teitotext">
<!--
	This library is free software; you can redistribute it and/or
	modify it under the terms of the GNU Lesser General Public
	License as published by the Free Software Foundation; either
	version 2.1 of the License, or (at your option) any later version.
	
	This library is distributed in the hope that it will be useful,
	but WITHOUT ANY WARRANTY; without even the implied warranty of
	MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
	Lesser General Public License for more details.
	
	You should have received a copy of the GNU Lesser General Public
	License along with this library; if not, write to the Free Software
	Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
	
        Id: $Id: build-to.xml 9319 2011-09-14 15:25:52Z rahtz $
        Copyright: 2011, TEI Consortium<
-->
  <!--
 Convert TEI documents into HTML files.
 -->
  <!-- Path to TEI XML file. -->
  <property name="inputFile" value=""/>
  <!-- Path where the outputfile will be saved. -->
  <property name="outputFile" value=""/>
  <!-- which profile -->
  <property name="profile" value="default"/>
  <!-- where does oxygen keep stuff -->
  <property name="oxygenlib" value=""/>
  <property name="profiledir" value="../profiles"/>
  <!-- Stylesheet for transformation -->
  <property name="odd2text"   value="${profiledir}/${profile}/txt/to.xsl"/>
  <property name="odd2oddxsl" value="../odds2/odd2odd.xsl"/>
  <dirname property="inputFileDir" file="${inputFile}"/>
  <dirname property="outputDir" file="${outputFile}"/>
  <property name="outputTempDir" value="${outputDir}/temp-dir-for-ant"/>
  <path id="classpath">
    <pathelement path="${java.class.path}"/>
  </path>
  <target name="setup">
    <delete dir="${outputTempDir}"/>
    <mkdir dir="${outputTempDir}"/>
  </target>

  <target name="dist" depends="setup,convert,cleanup"/>

  <target name="convert">
    <!-- Recreate temporary output directory -->
    <!-- The transformation for HTML output. -->
    <echo level="info">XSLT generate text file</echo>
    <xslt force="yes" style="${odd2text}" in="${inputFile}" out="${outputFile}" classpath="classpath">
      <xmlcatalog>
        <catalogpath>
          <pathelement location="../../../../catalog.xml"/>
          <pathelement location="../../../../../xhtml11/dtd/xhtmlcatalog.xml"/>
        </catalogpath>
      </xmlcatalog>
      <factory name="net.sf.saxon.TransformerFactoryImpl"/>
      <classpath location="${oxygenlib}/saxon9ee.jar"/>
      <param name="directory" expression="file:///${outputTempDir}"/>
      <!-- supply name of language-->
      <param name="lang" expression="${lang}" if="lang"/>
      <!-- emit some diagnostics"-->
      <param name="debug" expression="${debug}" if="debug"/>
      <!-- be verbose-->
      <param name="verbose" expression="${verbose}" if="verbose"/>
    </xslt>
  </target>

  <target name="cleanup" unless="debug">  
    <delete dir="${outputTempDir}"/>
  </target>

</project>
