<?xml version="1.0" encoding="UTF-8"?>

<project name="tet-xslt" default="all">
	
    <!--
    	The input file comes in two variants, with punctuation breaks and
        without
    -->
    <property name="infile.pb" value="FontReporter.tetml" />
    <property name="infile.nopb" value="FontReporter.nopb.tetml" />
    
    <!-- for selecting a table by number for the table target -->
    <property name="table.table-number" value="1" />
    <property name="table.page-number" value="0" />
    
    <!-- XSLT parameters for the fontfilter example -->
    <property name="fontfilter.font" value="TheSansBold-Plain" />
    <property name="fontfilter.min-size" value="10.0" />
    
    <!-- XSLT parameters for the tetml2html example -->
    <property name="tetml2html.debug" value="0" />
    <property name="tetml2html.toc-generate" value="1" />
    <property name="tetml2html.toc-exclude-min" value="3" />
    <property name="tetml2html.toc-exclude-max" value="4" />
    <property name="tetml2html.h1.min-size" value="24.9" />
    <property name="tetml2html.h1.max-size" value="10000" />
    <property name="tetml2html.h2.min-size" value="24" />
    <property name="tetml2html.h2.max-size" value="24.8" />
    <property name="tetml2html.h3.min-size" value="15" />
    <property name="tetml2html.h3.max-size" value="23.9" />
    <!-- "Impossible" values for unneeded heading levels -->
    <property name="tetml2html.h4.min-size" value="10001" />
    <property name="tetml2html.h4.max-size" value="10000" />
    <property name="tetml2html.h5.min-size" value="10001" />
    <property name="tetml2html.h5.max-size" value="10000" />

    <target name="all" depends="concordance, index, table, textonly, metadata,
        fontfilter, fontstat, fontfinder, tetml2html, runxslt" />

    <target name="concordance">
        <xslt in="${infile.pb}"
              style="concordance.xsl"
              out="concordance.txt" />
    </target>

    <target name="index">
        <xslt in="${infile.pb}" style="index.xsl" out="index.txt" />
    </target>

    <target name="table">
        <xslt in="${infile.pb}" style="table.xsl" out="table.csv">
            <param name="table-number" expression="${table.table-number}" />
            <param name="page-number" expression="${table.page-number}" />
        </xslt>
    </target>
    
    <target name="textonly">
        <xslt in="${infile.nopb}" style="textonly.xsl" out="textonly.txt" />
    </target>
    
    <target name="metadata">
        <xslt in="${infile.pb}" style="metadata.xsl" out="metadata.txt" />
    </target>
    
    <target name="fontfilter">
        <xslt in="${infile.pb}" style="fontfilter.xsl" out="fontfilter.txt">
            <param name="font" expression="${fontfilter.font}" />
            <param name="min-size" expression="${fontfilter.min-size}" />
        </xslt>
    </target>
    
    <target name="fontstat">
        <xslt in="${infile.pb}" style="fontstat.xsl" out="fontstat.txt" />
    </target>
    
    <target name="fontfinder">
        <xslt in="${infile.pb}" style="fontfinder.xsl" out="fontfinder.txt"/>
    </target>
    
    <target name="tetml2html">
        <xslt in="${infile.nopb}" style="tetml2html.xsl" out="tetml2html.html">
            <param name="debug" expression="${tetml2html.debug}" />
            <param name="generate-doc" expression="${tetml2html.toc-generate}" />
            <param name="toc-exclude-min" expression="${tetml2html.toc-exclude-min}" />
            <param name="toc-exclude-max" expression="${tetml2html.toc-exclude-max}" />
            <param name="h1.min-size" expression="${tetml2html.h1.min-size}" />
            <param name="h1.max-size" expression="${tetml2html.h1.max-size}" />
            <param name="h2.min-size" expression="${tetml2html.h2.min-size}" />
            <param name="h2.max-size" expression="${tetml2html.h2.max-size}" />
            <param name="h3.min-size" expression="${tetml2html.h3.min-size}" />
            <param name="h3.max-size" expression="${tetml2html.h3.max-size}" />
            <param name="h4.min-size" expression="${tetml2html.h4.min-size}" />
            <param name="h4.max-size" expression="${tetml2html.h4.max-size}" />
            <param name="h5.min-size" expression="${tetml2html.h5.min-size}" />
            <param name="h5.max-size" expression="${tetml2html.h5.max-size}" />
        </xslt>
    </target>
    
    <!--
        The "runxslt" Java program can also be used to run the XSLT samples.
    -->
    <target name="runxslt">
        <javac srcdir="." source="1.4" includes="runxslt.java"/>
    </target>
    
    <target name="clean">
        <delete file="concordance.txt" />
        <delete file="index.txt" />
        <delete file="table.csv" />
        <delete file="textonly.txt" />
        <delete file="metadata.txt" />
        <delete file="fontfilter.txt" />
        <delete file="fontstat.txt" />
        <delete file="fontfinder.txt" />
        <delete file="tetml2html.html" />
        <delete file="runxslt.class" />
    </target>
</project>
