ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From James Fuller <>
Subject Re: AW: AW: Converting new or changed files with an batch file called from within ant
Date Tue, 12 Apr 2005 11:33:38 GMT
Huditsch Roman wrote:

>Hi James,
>As you may have seen by my previous posts on the list,
>I managed to make some progress :)))
its great to see you getting the hang of things...though there are many
refactoring opportunities with your build file

a) instead of creating one large target, try to break it apart and
define dependencies using the depends attribute on <target/>

for example you could define a pre, process, and post targets...with the
pre deleting then making dirs, process just generating transformation,
then the post doing any cleanup

b) the uptodate task will check  if a source file  is up to date (date
wise ) with its target

  <uptodate property="xmlBuild.notRequired" targetfile="${deploy}\xmlClasses.jar" >
    <srcfiles dir= "${src}/xml" includes="**/*.dtd"/>

the above will set xmlBuild.notRequired it date of targetfile (xmlClasses.jar) is up to date
with all dtd under ${src}/xml directory

details here

then u will have to process based on the result of the property (if set or not)

you could create a target for each xslt process, then use if/unless attributes with this
would have to createa an uptodate entry per transform as well

though the problem is since u are defining transforms on a directory by directory basis, the
only gain u will get if no files 
have changed in the entire dir (then that transform will not run)

note: I would investigate the ant-contrib task as you will be able to do some
some point you would rather generically define a process then iterate over a list of dirs....small
steps first though

gl, Jim Fuller

>>check out the manual page for all options 
>I was able to define my definitions in a working way at least:
><xslt basedir="source" destdir="added" style="stylesheets/add_versioning_information.xslt"
classpath="net.sf.saxon.Transform" processor="trax" extension=".xml" includes="*.xml" excludes="*/*.xml"/>
>The only issue to solve is now the <uptodate> property....
>I don't know where to set this property or where to use it in my target....
>Here is my build file so far:
><?xml version="1.0" encoding="ISO-8859-1"?>
><project name="Content Produktion" default="GLP_Legislation" basedir=".">
>	<description>für die Plattformen "GLP", "Recht Online" und "ARD Online"</description>
>	<target name="GLP_Legislation" description="Normen, Verordnungen, Staatsverträge,...">
>		<echo>==============================</echo>
>		<echo>Transforming Legisations</echo>
>		<echo>Processing...</echo>
>		<echo>==============================</echo>
>		<mkdir dir="added"/>
>		<xslt basedir="source" destdir="added" style="stylesheets/add_versioning_information.xslt"
classpath="net.sf.saxon.Transform" processor="trax" extension=".xml" includes="*.xml" excludes="*/*.xml"/>
>		<echo>Adding version information done</echo>
>		<mkdir dir="splitted"/>
>		<xslt basedir="added" destdir="splitted" style="stylesheets/split_legislation.xslt"
classpath="net.sf.saxon.Transform" processor="trax" extension=".xml"/>
>		<!-- ===================================================================	-->
>		<!-- Delete unneeded files created during splitting							-->
>		<!-- ===================================================================	-->
>		<delete>
>			<fileset dir="splitted">
>				<patternset>
>					<include name="*.xml"/>
>				</patternset>
>				<size value="0" units="Ki" when="equal"/>
>			</fileset>
>		</delete>
>		<delete dir="added"/>
>		<echo>Splitting done</echo>
>		<mkdir dir="dates_converted"/>
>		<xslt basedir="splitted" destdir="dates_converted" style="stylesheets/convert_date.xslt"
classpath="net.sf.saxon.Transform" processor="trax" extension=".xml"/>
>		<delete dir="splitted"/>
>		<echo>Converting dates done</echo>
>		<mkdir dir="cleaned"/>
>		<xslt basedir="dates_converted" destdir="cleaned" style="stylesheets/clean_structure.xslt"
classpath="net.sf.saxon.Transform" processor="trax" extension=".xml"/>
>		<delete dir="dates_converted"/>
>		<echo>Structure cleaned</echo>
>		<mkdir dir="resolved"/>
>		<xslt basedir="cleaned" destdir="resolved" style="stylesheets/resolve_keyword_links.xslt"
classpath="net.sf.saxon.Transform" processor="trax" extension=".xml"/>
>		<delete dir="cleaned"/>
>		<echo>Keyword links resolved</echo>
>		<mkdir dir="normalized"/>
>		<xslt basedir="resolved" destdir="normalized" style="stylesheets/normalize_space.xslt"
classpath="net.sf.saxon.Transform" processor="trax" extension=".xml"/>
>		<delete dir="resolved"/>
>		<echo>Document normalized</echo>
>		<xslt basedir="normalized" destdir="result" style="stylesheets/convert_to_LNDE.xslt"
classpath="net.sf.saxon.Transform" processor="trax" extension=".xml"/>
>		<delete dir="normalized"/>
>		<echo>Conversion finished</echo>
>	</target>
>Can you tell me, where to put the <update>?
>Thanks a lot for your patience!
>To unsubscribe, e-mail:
>For additional commands, e-mail:

To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message