<?xml version="1.0" encoding="UTF-8"?>
<!-- This is a build file for Apache ant (http://ant.apache.org/). This has been tested with Ant 1.7. -->
<project name="wcag20" basedir="." default="usage">

	<description>Generate WCAG 2.0 and related documents</description>
	
	<!-- Load overriding properties -->
	<xmlproperty file="build.properties" keeproot="false" semanticattributes="true"/>
	
	<!-- The following properties need to be set appropriately before doing a build - they should all be overridden by the above property file, but are kept here to serve as defaults -->
	<property name="pubdate" value="20090123" description="Publication date of this version of the documents, in YYYYMMDD format, used to generate the output directory"/>
	<property name="pubdate.previous" value="20081211" description="Publication date of a previous version of the documents, used to find the folder from which to copy static files (images, CSS) into the new output directory"/>
	
	<property name="guidelines.w3c-version" value="REC" description="W3C version of the guidelines, used to generate the output directory"/>
	<property name="understanding.w3c-version" value="NOTE" description="W3C version of understanding, used to generate the output directory"/>
	<property name="techniques.w3c-version" value="NOTE" description="W3C version of the techniques, used to generate the output directory"/>

	<property name="guidelines.w3c-version.previous" value="REC" description="W3C version of a previous version of the guidelines, used to find the folder from which to copy static files (images, CSS) into the new output directory"/>
	<property name="understanding.w3c-version.previous" value="NOTE" description="W3C version of a previous version of understanding, used to find the folder from which to copy static files (images, CSS) into the new output directory"/>
	<property name="techniques.w3c-version.previous" value="NOTE" description="W3C version of a previous version of the techniques, used to find the folder from which to copy static files (images, CSS) into the new output directory"/>
	
	<property name="outputdir" location="." description="Directory within which the output folders are created, normally &quot;.&quot; unless doing TR in which case it is &quot;../../../TR/&lt;YYYY&gt;&quot;"/>
	<property name="outputdir.previous" location="." description="Directory in which previous build containing static files is located, almost always &quot;.&quot;"/>

	<property name="slices" value="true" description="Set to &quot;true&quot; to output mutliple-file versions"/>
	
	<property name="monolithic" value="true" description="Set to &quot;true&quot; to output single-file version"/>
	
	<property name="diffspec" value="false" description="Set to &quot;true&quot; to output a diff version (as a separate copy of monolithic versions, but as the only format for multiple-file versions)"/>
	
	<property name="ednotes" value="1" description="Whether to output editorial notes"/>
	
	<property name="xslt.factory" value="net.sf.saxon.TransformerFactoryImpl" description="Class name of the XSLT transformer factory, which sets which XSLT engine to use; must be an XSLT 2.0 processor"/>
	
	<!-- The following properties usually do not need to be adjusted -->
	<property name="source.guidelines" location="sources/wcag2-src.xml"/>
	<property name="source.understanding" location="sources/guide-to-wcag2-src.xml"/>
	<property name="source.techniques" location="sources/wcag20-merged-techs.xml"/>
	<property name="source.quickref" location="sources/wcag2-quickref.xml"/>
	<property name="source.quickref.leadin" location="sources/quickref-leadin.php"/>
	<property name="source.refs" location="sources/refs.xml"/>
	
	<property name="cvs.basedir" location="../../../../../"/>
	
	<property name="outputdir.guidelines" location="${outputdir}/${guidelines.w3c-version}-WCAG20-${pubdate}"/>
	<property name="outputdir.understanding" location="${outputdir}/${understanding.w3c-version}-UNDERSTANDING-WCAG20-${pubdate}"/>
	<property name="outputdir.techniques" location="${outputdir}/${techniques.w3c-version}-WCAG20-TECHS-${pubdate}"/>
	<property name="outputdir.quickref" location="../../WCAG20/quickref/${pubdate}"/>
	
	<property name="outputdir.guidelines.previous" location="${outputdir.previous}/${guidelines.w3c-version.previous}-WCAG20-${pubdate.previous}"/>
	<property name="outputdir.understanding.previous" location="${outputdir.previous}/${understanding.w3c-version.previous}-UNDERSTANDING-WCAG20-${pubdate.previous}"/>
	<property name="outputdir.techniques.previous" location="${outputdir.previous}/${techniques.w3c-version.previous}-WCAG20-TECHS-${pubdate.previous}"/>
	<property name="outputdir.quickref.previous" location="../../WCAG20/quickref/${pubdate.previous}"/>
	
	<property name="outputdir.zip" location="../../WCAG20/versions"/>
	<property name="outputdir.zip.guidelines" location="${outputdir.zip}/guidelines"/>
	<property name="outputdir.zip.understanding" location="${outputdir.zip}/understanding"/>
	<property name="outputdir.zip.techniques" location="${outputdir.zip}/techniques"/>
	
	<!--
	<path id="saxon.classpath">
		<fileset dir="C:\Documents\Java\saxonb9-1-0-2j">
			<include name="saxon9.jar"/>
			<include name="saxon9-dom.jar"/>
			<include name="saxon9-xpath.jar"/>
		</fileset>
		<pathelement location="C:\Documents\Java\saxon-ant9-1\saxon9-ant.jar"/>
	</path>
	-->
	
	<filelist id="techs" description="Individual technique files" dir="sources">
		<file name="ARIA-tech-src.xml"/>
		<file name="html-tech-src.xml"/>
		<file name="css-tech.xml"/>
		<file name="script-tech-src.xml"/>
		<file name="server-tech-src.xml"/>
		<file name="SMIL-tech-src.xml"/>
		<file name="plain-text-tech-src.xml"/>
		<file name="failure-tech-src.xml"/>
		<file name="flash-tech-src.xml"/>
		<file name="pdf-tech-src.xml"/>
		<file name="silverlight-tech-src.xml"/>
		<file name="general-tech-src.xml"/>
	</filelist>
	
	<!-- Saxon XSLT -->
	<!-- This task is not needed since Saxon can be called with the transformer factory, though it provides additional features -->
	<!--
	<taskdef name="saxon-xslt" classname="net.sf.saxon.ant.AntTransform">
		<classpath refid="saxon.classpath"/>
	</taskdef>
	-->
	
	<target name="usage">
		<echo level="info">Usage: &quot;ant &lt;target&gt;&quot; to execute a build task
Enter &quot;ant -projecthelp&quot; to get list of available build tasks</echo>
	</target>
	
	<target name="init">
		<!-- Set properties that affect whether diff and slices output, done here because 1) the conditions in targets can only depend on whether a property is set, not its value, while it is more convenient to define the property so it isn't forgotten about, and 2) the conditions intersect, and this resolves those. -->
		<condition property="monolithic.nodiff">
			<equals arg1="${monolithic}" arg2="true"/>
		</condition>
		<condition property="monolithic.diff">
			<and>
				<equals arg1="${monolithic}" arg2="true"/>
				<equals arg1="${diffspec}" arg2="true"/>
			</and>
		</condition>
		<condition property="slices.nodiff">
			<and>
				<equals arg1="${slices}" arg2="true"/>
				<not>
					<equals arg1="${diffspec}" arg2="true"/>
				</not>
			</and>
		</condition>
		<condition property="slices.diff">
			<and>
				<equals arg1="${slices}" arg2="true"/>
				<equals arg1="${diffspec}" arg2="true"/>
			</and>
		</condition>
		<!-- For now, not doing CVS within the build process -->
		<!--<cvs command="update"/>-->
	</target>
	<!--<target name="clean" description="Clean up any temp files"></target>-->
	
	<!-- === Static content === -->
	<target name="guidelines.static" description="Copy static files for guidelines into new directory" depends="init">
		<copy todir="${outputdir.guidelines}">
			<fileset dir="${outputdir.guidelines.previous}">
				<exclude name="*.html"/>
				<exclude name="CVS/"/>
			</fileset>
		</copy>
	</target>
	<target name="understanding.static" description="Copy static files for understanding into new directory" depends="init">
		<copy todir="${outputdir.understanding}">
			<fileset dir="${outputdir.understanding.previous}">
				<exclude name="*.html"/>
				<exclude name="CVS/"/>
			</fileset>
		</copy>
	</target>
	<target name="techniques.static" description="Copy static files for techniques into new directory" depends="init">
		<copy todir="${outputdir.techniques}">
			<fileset dir="${outputdir.techniques.previous}">
				<exclude name="*.html"/>
				<exclude name="CVS/"/>
			</fileset>
		</copy>
	</target>
	<target name="quickref.static" description="Copy static files for quickref into new directory" depends="init">
		<copy todir="${outputdir.quickref}">
			<fileset dir="${outputdir.quickref.previous}">
				<exclude name="*.html"/>
				<exclude name="*.php"/>
				<exclude name="CVS/"/>
			</fileset>
		</copy>
	</target>
	<target name="all.static" description="Copy static files into new directories" depends="guidelines.static, understanding.static, techniques.static, quickref.static"/>
	
	<!-- === HTML versions === -->
	<!-- Guidelines -->
	<target name="guidelines.single" depends="init">
		<mkdir dir="${outputdir.guidelines}"/>
		<xslt in="${source.guidelines}" out="${outputdir.guidelines}/Overview.html" style="sources/diffspec.xsl" force="true">
			<factory name="net.sf.saxon.TransformerFactoryImpl">
				<attribute name="http://saxon.sf.net/feature/xinclude-aware" value="true"/>
			</factory>
			<param name="show.diff.markup" expression="0"/>
			<param name="show.issue.links" expression="0"/>
			<param name="show.ednotes" expression="${ednotes}" if="ednotes"/>
			<param name="glthisversion" expression=""/>
			<param name="guidethisversion" expression="${understanding.uri}" if="understanding.uri"/>
			<param name="techsthisversion" expression="${techniques.uri}" if="techniques.uri"/>
			<param name="guidelines.file" expression="file:///${source.guidelines}"/>
			<param name="understanding.file" expression="file:///${source.understanding}"/>
			<param name="techniques.file" expression="file:///${source.techniques}"/>
			<param name="quickref.file" expression="file:///${source.quickref}"/>
			<param name="refs.file" expression="file:///${source.refs}"/>
		</xslt>
	</target>
	<target name="guidelines.single.diff" depends="init" if="monolithic.diff">
		<mkdir dir="${outputdir.guidelines}"/>
		<xslt in="${source.guidelines}" out="${outputdir.guidelines}/Overview-diff.html" style="sources/diffspec.xsl" force="true">
			<factory name="net.sf.saxon.TransformerFactoryImpl">
				<attribute name="http://saxon.sf.net/feature/xinclude-aware" value="true"/>
			</factory>
			<param name="show.diff.markup" expression="1"/>
			<param name="show.issue.links" expression="1"/>
			<param name="show.ednotes" expression="${ednotes}" if="ednotes"/>
			<param name="glthisversion" expression=""/>
			<param name="guidethisversion" expression="${understanding.uri}" if="understanding.uri"/>
			<param name="techsthisversion" expression="${techniques.uri}" if="techniques.uri"/>
			<param name="guidelines.file" expression="file:///${source.guidelines}"/>
			<param name="understanding.file" expression="file:///${source.understanding}"/>
			<param name="techniques.file" expression="file:///${source.techniques}"/>
			<param name="quickref.file" expression="file:///${source.quickref}"/>
			<param name="refs.file" expression="file:///${source.refs}"/>
		</xslt>
	</target>
	<target name="guidelines" depends="guidelines.single, guidelines.single.diff" description="Generate Guidelines"/>
	
	<!-- Understanding -->
	<target name="understanding.single" depends="init">
		<mkdir dir="${outputdir.understanding}"/>
		<xslt in="${source.understanding}" out="${outputdir.understanding}/complete.html" style="sources/diffspec-howto.xsl" force="true">
			<factory name="net.sf.saxon.TransformerFactoryImpl">
				<attribute name="http://saxon.sf.net/feature/xinclude-aware" value="true"/>
			</factory>
			<param name="show.diff.markup" expression="0"/>
			<param name="show.issue.links" expression="0"/>
			<param name="show.ednotes" expression="${ednotes}" if="ednotes"/>
			<param name="glthisversion" expression="${guidelines.uri}" if="guidelines.uri"/>
			<param name="guidethisversion" expression=""/>
			<param name="techsthisversion" expression="${techniques.uri}" if="techniques.uri"/>
			<param name="guidelines.file" expression="file:///${source.guidelines}"/>
			<param name="understanding.file" expression="file:///${source.understanding}"/>
			<param name="techniques.file" expression="file:///${source.techniques}"/>
			<param name="quickref.file" expression="file:///${source.quickref}"/>
			<param name="refs.file" expression="file:///${source.refs}"/>
		</xslt>
	</target>
	<target name="understanding.single.diff" depends="init" if="monolithic.diff">
		<mkdir dir="${outputdir.understanding}"/>
		<xslt in="${source.understanding}" out="${outputdir.understanding}/complete-diff.html" style="sources/diffspec-howto.xsl" force="true">
			<factory name="net.sf.saxon.TransformerFactoryImpl">
				<attribute name="http://saxon.sf.net/feature/xinclude-aware" value="true"/>
			</factory>
			<param name="show.diff.markup" expression="1"/>
			<param name="show.issue.links" expression="1"/>
			<param name="show.ednotes" expression="${ednotes}" if="ednotes"/>
			<param name="glthisversion" expression="${guidelines.uri}" if="guidelines.uri"/>
			<param name="guidethisversion" expression=""/>
			<param name="techsthisversion" expression="${techniques.uri}" if="techniques.uri"/>
			<param name="guidelines.file" expression="file:///${source.guidelines}"/>
			<param name="understanding.file" expression="file:///${source.understanding}"/>
			<param name="techniques.file" expression="file:///${source.techniques}"/>
			<param name="quickref.file" expression="file:///${source.quickref}"/>
			<param name="refs.file" expression="file:///${source.refs}"/>
		</xslt>
	</target>
	<target name="understanding.slices" depends="init">
		<mkdir dir="${outputdir.understanding}"/>
		<xslt in="${source.understanding}" out="temp.html" style="sources/slices-understanding-common.xsl" force="true">
			<factory name="net.sf.saxon.TransformerFactoryImpl">
				<attribute name="http://saxon.sf.net/feature/xinclude-aware" value="true"/>
			</factory>
			<param name="show.diff.markup" expression="0" if="slices.nodiff"/>
			<param name="show.issue.links" expression="0" if="slices.nodiff"/>
			<param name="show.diff.markup" expression="1" if="slices.diff"/>
			<param name="show.issue.links" expression="1" if="slices.diff"/>
			<param name="show.ednotes" expression="${ednotes}" if="ednotes"/>
			<param name="output.dir" expression="file:/${outputdir.understanding}"/>
			<param name="glthisversion" expression="${guidelines.uri}" if="guidelines.uri"/>
			<param name="guidethisversion" expression=""/>
			<param name="techsthisversion" expression="${techniques.uri}" if="techniques.uri"/>
			<param name="guidelines.file" expression="file:///${source.guidelines}"/>
			<param name="understanding.file" expression="file:///${source.understanding}"/>
			<param name="techniques.file" expression="file:///${source.techniques}"/>
			<param name="quickref.file" expression="file:///${source.quickref}"/>
			<param name="refs.file" expression="file:///${source.refs}"/>
		</xslt>
		<delete file="temp.html"/>
	</target>
	<target name="understanding" depends="understanding.single, understanding.single.diff, understanding.slices" description="Generate Understanding"/>

	<!-- Techniques -->
	
	<!-- This target is only needed if generating an explicit merged techniques document, a pattern now removed. If returning to that pattern, targets that process wcag20-merged-techs.xml will need to change back to merged-techs.xml. -->
	<target name="techniques-merge" depends="init">
		<xslt in="${source.techniques}" out="sources/merged-techs.xml" style="sources/techs-merge.xslt">
			<factory name="net.sf.saxon.TransformerFactoryImpl">
				<attribute name="http://saxon.sf.net/feature/xinclude-aware" value="true"/>
			</factory>
		</xslt>
	</target>
	<target name="techniques.single" depends="init">
		<mkdir dir="${outputdir.techniques}"/>
		<xslt in="${source.techniques}" out="${outputdir.techniques}/complete.html" style="sources/diffspec-tech.xsl" force="true">
			<factory name="net.sf.saxon.TransformerFactoryImpl">
				<attribute name="http://saxon.sf.net/feature/xinclude-aware" value="true"/>
			</factory>
			<param name="show.diff.markup" expression="0"/>
			<param name="show.issue.links" expression="0"/>
			<param name="show.ednotes" expression="${ednotes}" if="ednotes"/>
			<param name="glthisversion" expression="${guidelines.uri}" if="guidelines.uri"/>
			<param name="guidethisversion" expression="${understanding.uri}" if="understanding.uri"/>
			<param name="techsthisversion" expression="${techniques.uri}" if="techniques.uri"/>
			<param name="guidelines.file" expression="file:///${source.guidelines}"/>
			<param name="understanding.file" expression="file:///${source.understanding}"/>
			<param name="techniques.file" expression="file:///${source.techniques}"/>
			<param name="quickref.file" expression="file:///${source.quickref}"/>
			<param name="refs.file" expression="file:///${source.refs}"/>
		</xslt>
	</target>
	<target name="techniques.single.diff" depends="init" if="monolithic.diff">
		<mkdir dir="${outputdir.techniques}"/>
		<xslt in="${source.techniques}" out="${outputdir.techniques}/complete-diff.html" style="sources/diffspec-tech.xsl" force="true">
			<factory name="net.sf.saxon.TransformerFactoryImpl">
				<attribute name="http://saxon.sf.net/feature/xinclude-aware" value="true"/>
			</factory>
			<param name="show.diff.markup" expression="1"/>
			<param name="show.issue.links" expression="1"/>
			<param name="show.ednotes" expression="${ednotes}" if="ednotes"/>
			<param name="glthisversion" expression="${guidelines.uri}" if="guidelines.uri"/>
			<param name="guidethisversion" expression="${understanding.uri}" if="understanding.uri"/>
			<param name="techsthisversion" expression="${techniques.uri}" if="techniques.uri"/>
			<param name="guidelines.file" expression="file:///${source.guidelines}"/>
			<param name="understanding.file" expression="file:///${source.understanding}"/>
			<param name="techniques.file" expression="file:///${source.techniques}"/>
			<param name="quickref.file" expression="file:///${source.quickref}"/>
			<param name="refs.file" expression="file:///${source.refs}"/>
		</xslt>
	</target>
	<target name="techniques.slices" depends="init">
		<mkdir dir="${outputdir.techniques}"/>
		<xslt in="${source.techniques}" out="temp.html" style="sources/slices-techniques-common.xsl" force="true">
			<factory name="net.sf.saxon.TransformerFactoryImpl">
				<attribute name="http://saxon.sf.net/feature/xinclude-aware" value="true"/>
			</factory>
			<param name="show.diff.markup" expression="0" if="slices.nodiff"/>
			<param name="show.issue.links" expression="0" if="slices.nodiff"/>
			<param name="show.diff.markup" expression="1" if="slices.diff"/>
			<param name="show.issue.links" expression="1" if="slices.diff"/>
			<param name="show.ednotes" expression="${ednotes}" if="ednotes"/>
			<param name="output.dir" expression="file:/${outputdir.techniques}"/>
			<param name="glthisversion" expression="${guidelines.uri}" if="guidelines.uri"/>
			<param name="guidethisversion" expression="${understanding.uri}" if="understanding.uri"/>
			<param name="techsthisversion" expression="${techniques.uri}" if="techniques.uri"/>
			<param name="guidelines.file" expression="file:///${source.guidelines}"/>
			<param name="understanding.file" expression="file:///${source.understanding}"/>
			<param name="techniques.file" expression="file:///${source.techniques}"/>
			<param name="quickref.file" expression="file:///${source.quickref}"/>
			<param name="refs.file" expression="file:///${source.refs}"/>
		</xslt>
		<delete file="temp.html"/>
	</target>
	<target name="techniques.bytech" depends="init">
		<mkdir dir="${outputdir.techniques}"/>
		<xslt destdir="${outputdir.techniques}" style="sources/diffspec-tech.xsl" force="true">
			<factory name="net.sf.saxon.TransformerFactoryImpl">
				<attribute name="http://saxon.sf.net/feature/xinclude-aware" value="true"/>
			</factory>
			<param name="bytech" expression="1"/>
			<param name="show.diff.markup" expression="0" if="slices.nodiff"/>
			<param name="show.issue.links" expression="0" if="slices.nodiff"/>
			<param name="show.diff.markup" expression="1" if="slices.diff"/>
			<param name="show.issue.links" expression="1" if="slices.diff"/>
			<param name="show.ednotes" expression="${ednotes}" if="ednotes"/>
			<param name="glthisversion" expression="${guidelines.uri}" if="guidelines.uri"/>
			<param name="guidethisversion" expression="${understanding.uri}" if="understanding.uri"/>
			<param name="techsthisversion" expression="${techniques.uri}" if="techniques.uri"/>
			<param name="guidelines.file" expression="file:///${source.guidelines}"/>
			<param name="understanding.file" expression="file:///${source.understanding}"/>
			<param name="techniques.file" expression="file:///${source.techniques}"/>
			<param name="quickref.file" expression="file:///${source.quickref}"/>
			<param name="refs.file" expression="file:///${source.refs}"/>
			<filelist refid="techs"/>
			<mapper>
				<globmapper from="ARIA-tech-src.xml" to="aria.html"/>
				<globmapper from="html-tech-src.xml" to="html.html"/>
				<globmapper from="css-tech.xml" to="css.html"/>
				<globmapper from="script-tech-src.xml" to="client-side-script.html"/>
				<globmapper from="server-tech-src.xml" to="server-side-script.html"/>
				<globmapper from="SMIL-tech-src.xml" to="smil.html"/>
				<globmapper from="plain-text-tech-src.xml" to="text.html"/>
				<globmapper from="failure-tech-src.xml" to="failures.html"/>
				<globmapper from="flash-tech-src.xml" to="flash.html"/>
				<globmapper from="pdf-tech-src.xml" to="pdf.html"/>
				<globmapper from="silverlight-tech-src.xml" to="silverlight.html"/>
				<globmapper from="general-tech-src.xml" to="general.html"/>
			</mapper>
		</xslt>
	</target>
	<target name="techniques" description="Generate Techniques" depends="init, techniques.single, techniques.single.diff, techniques.slices, techniques.bytech"/>
	
	<!-- Quickref -->
	<target name="quickref" depends="init" description="Generate Quickref">
		<mkdir dir="${outputdir.quickref}"/>
		<xslt in="${source.quickref}" out="quickref-temp.php" style="sources/diffspec-quickref.xsl" force="true">
			<factory name="net.sf.saxon.TransformerFactoryImpl">
				<attribute name="http://saxon.sf.net/feature/xinclude-aware" value="true"/>
			</factory>
			<param name="show.diff.markup" expression="0" if="monolithic.nodiff"/>
			<param name="show.diff.markup" expression="1" if="monolithic.diff"/>
			<param name="show.ednotes" expression="${ednotes}" if="ednotes"/>
			<param name="guidelines.file" expression="file:///${source.guidelines}"/>
			<param name="understanding.file" expression="file:///${source.understanding}"/>
			<param name="techniques.file" expression="file:///${source.techniques}"/>
			<param name="quickref.file" expression="file:///${source.quickref}"/>
			<param name="refs.file" expression="file:///${source.refs}"/>
		</xslt>
		<concat destfile="${outputdir.quickref}/Overview.php" force="true">
			<filelist dir=".">
				<file name="${source.quickref.leadin}"/>
				<file name="quickref-temp.php"/>
			</filelist>
		</concat>
		<delete file="quickref-temp.php"/>
	</target>
	
	<!-- Everything -->
	<target name="all" depends="guidelines, understanding, techniques, quickref" description="Generate entire suite"/>
	
	<!-- === Zip files of HTML versions === -->
	<target name="guidelines.zip" depends="guidelines" description="Create zip and tgz files for the Guidelines">
		<mkdir dir="${outputdir.zip.guidelines}"/>
		<zip basedir="${outputdir.guidelines}" destfile="${outputdir.zip.guidelines}/wcag20-guidelines.zip" level="9">
			<exclude name="CVS/"/>
		</zip>
		<tar basedir="${outputdir.guidelines}" destfile="${outputdir.zip.guidelines}/wcag20-guidelines.tar">
			<exclude name="CVS/"/>
		</tar>
		<gzip src="${outputdir.zip.guidelines}/wcag20-guidelines.tar" destfile="${outputdir.zip.guidelines}/wcag20-guidelines.tgz"/>
		<delete file="${outputdir.zip.guidelines}/wcag20-guidelines.tar"/>
	</target>
	<target name="understanding.zip" depends="understanding" description="Create zip and tgz files for  Understanding">
		<mkdir dir="${outputdir.zip.understanding}"/>
		<zip basedir="${outputdir.understanding}" destfile="${outputdir.zip.understanding}/wcag20-understanding.zip" level="9">
			<exclude name="CVS/"/>
		</zip>
		<tar basedir="${outputdir.understanding}" destfile="${outputdir.zip.understanding}/wcag20-understanding.tar">
			<exclude name="CVS/"/>
		</tar>
		<gzip src="${outputdir.zip.understanding}/wcag20-understanding.tar" destfile="${outputdir.zip.understanding}/wcag20-understanding.tgz"/>
		<delete file="${outputdir.zip.understanding}/wcag20-understanding.tar"/>
	</target>
	<target name="techniques.zip" depends="techniques" description="Create zip and tgz files for the Techniques">
		<mkdir dir="${outputdir.zip.techniques}"/>
		<zip basedir="${outputdir.techniques}" destfile="${outputdir.zip.techniques}/wcag20-techniques.zip" level="9">
			<exclude name="CVS/"/>
		</zip>
		<tar basedir="${outputdir.techniques}" destfile="${outputdir.zip.techniques}/wcag20-techniques.tar">
			<exclude name="CVS/"/>
		</tar>
		<gzip src="${outputdir.zip.techniques}/wcag20-techniques.tar" destfile="${outputdir.zip.techniques}/wcag20-techniques.tgz"/>
		<delete file="${outputdir.zip.techniques}/wcag20-techniques.tar"/>
	</target>
	<target name="all.zip" depends="guidelines.zip, understanding.zip, techniques.zip" description="Generate zip and tgz files for the entire suite">
		<!-- Generate guidelines, understanding, and techniques slightly differently for the monolithic zip -->
		<antcall>
			<target name="guidelines"/>
			<target name="understanding"/>
			<target name="techniques"/>
			<!-- Override the cross reference URIs to be appropriate to the zip file. The parameters are passed along only if these properties are set from this task. -->
			<param name="guidelines.uri" value="../guidelines/"/>
			<param name="understanding.uri" value="../understanding/"/>
			<param name="techniques.uri" value="../techniques/"/>
		</antcall>
		<mkdir dir="${outputdir.zip}"/>
		<zip destfile="${outputdir.zip}/wcag20-all.zip" level="9">
			<zipfileset dir="${outputdir.guidelines}" prefix="guidelines">
				<exclude name="CVS/"/>	
			</zipfileset>
			<zipfileset dir="${outputdir.understanding}" prefix="understanding">
				<exclude name="CVS/"/>	
			</zipfileset>
			<zipfileset dir="${outputdir.techniques}" prefix="techniques">
				<exclude name="CVS/"/>	
			</zipfileset>
		</zip>
		<tar destfile="${outputdir.zip}/wcag20-all.tar">
			<zipfileset dir="${outputdir.guidelines}" prefix="guidelines">
				<exclude name="CVS/"/>	
			</zipfileset>
			<zipfileset dir="${outputdir.understanding}" prefix="understanding">
				<exclude name="CVS/"/>	
			</zipfileset>
			<zipfileset dir="${outputdir.techniques}" prefix="techniques">
				<exclude name="CVS/"/>	
			</zipfileset>
		</tar>
		<gzip src="${outputdir.zip}/wcag20-all.tar" destfile="${outputdir.zip}/wcag20-all.tgz"/>
		<delete file="${outputdir.zip}/wcag20-all.tar"/>
		<!-- Delete the generated HTML files because they're no good for checking into CVS, relative urls are specific to the zip file -->
		<delete>
			<fileset dir="${outputdir.guidelines}" includes="*.html"/>
			<fileset dir="${outputdir.understanding}" includes="*.html"/>
			<fileset dir="${outputdir.techniques}" includes="*.html"/>
		</delete>
	</target>
	
	<!-- === XSL:FO versions === -->
	<target name="guidelines.fo" depends="init"></target>
	<target name="understanding.fo" depends="init"></target>
	<target name="techniques.fo" depends="init"></target>
	<target name="all.fo" depends="init, guidelines.fo, understanding.fo, techniques.fo"></target>
	
	<!-- === Sanity check === -->
	<target name="sanity" depends="init" description="Identifies cross-referencing inconsistencies between documents">
		<xslt in="${source.guidelines}" out="sources/sanity.html" style="sources/misc/sanity-check.xslt" force="true">
			<factory name="net.sf.saxon.TransformerFactoryImpl">
				<attribute name="http://saxon.sf.net/feature/xinclude-aware" value="true"/>
			</factory>
			<param name="guidelines.file" expression="file:///${source.guidelines}"/>
			<param name="understanding.file" expression="file:///${source.understanding}"/>
			<param name="techniques.file" expression="file:///${source.techniques}"/>
		</xslt>
	</target>
	
	<!-- === ID List === -->
	<target name="id-list" depends="init" description="Generates structured IDs for the comment form and placeholder sections">
		<xslt in="${source.guidelines}" out="sources/misc/id-list.html" style="sources/misc/id-list.xslt" force="true">
			<factory name="net.sf.saxon.TransformerFactoryImpl">
				<attribute name="http://saxon.sf.net/feature/xinclude-aware" value="true"/>
			</factory>
			<param name="techniques.file" expression="file:///${source.techniques}"/>
		</xslt>
	</target>
	
	<!-- === Remove diff markup === -->
	<target name="diff" depends="init" description="Remove diff markup from source files">
		<xslt style="sources/remove-diff-markup.xsl" destdir="sources" useimplicitfileset="false" force="true">
			<factory name="net.sf.saxon.TransformerFactoryImpl">
				<attribute name="http://saxon.sf.net/feature/xinclude-aware" value="true"/>
			</factory>
			<filelist>
				<!--<file name="${source.guidelines}"/>-->
				<file name="${source.understanding}"/>
			</filelist>
			<filelist refid="techs"/>
			<chainedmapper>
				<flattenmapper/>
				<globmapper from="*.xml" to="*.xml.new"/>
			</chainedmapper>
		</xslt>
		<copy todir="sources">
			<filelist>
				<!--<file name="${source.guidelines}"/>-->
				<file name="${source.understanding}"/>
			</filelist>
			<filelist refid="techs"/>
			<chainedmapper>
				<flattenmapper/>
				<globmapper from="*.xml" to="*.xml.bak"/>
			</chainedmapper>
		</copy>
		<move todir="sources">
			<fileset dir="sources" includes="*.xml.new"/>
			<globmapper from="*.xml.new" to="*.xml"/>
		</move>
	</target>
	
</project>
