you could do something like
<?xml version='1.0'?>
<project name='transform' default='build' basedir=".">
<taskdef resource="net/sf/antcontrib/antcontrib.properties"/>
<property name="jar.saxon" location="/opt/saxon/saxon8.jar"/>
<macrodef name="transform">
<attribute name="src"/>
<attribute name="dest"/>
<attribute name="style"/>
<sequential>
<mkdir dir="@{dest}"/>
<uptodate property="transform.notRequired">
<srcfiles dir= "@{src}" includes="**/*.xml"/>
<mapper type="merge" to="@{dest}/**/*.html"/>
</uptodate>
<if>
<equals arg1="${transform.notRequired}" arg2="true" />
<then>
Transform not required
</then>
<else>
<xslt in="@{src}"
out="@{dest}"
style="@{style}"
extension=".html"
includes="**.xml"
basedir=".">
<outputproperty name="method" value="xml"/>
<outputproperty name="standalone" value="yes"/>
<outputproperty name="encoding" value="iso8859_1"/>
<outputproperty name="indent" value="yes"/>
<classpath>
<pathelement location="${jar.saxon}"/>
</classpath>
</xslt>
</else>
</if>
</sequential>
</macrodef>
<target name='build'>
<transform src="test" dest="webroot" style="xsl/index.xsl"/>
</target>
</project>
using ant-contrib's if task....once again u still only get dir by dir
checking, this could easily be customised to work on a per file basis
(then iterate using <for/> task)...though as you can see things get more
procedural..
gl, Jim Fuller
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
For additional commands, e-mail: user-help@ant.apache.org
|