ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Huditsch Roman" <Roman.Hudit...@lexisnexis.at>
Subject AW: AW: Converting new or changed files with an batch file called from within ant
Date Wed, 13 Apr 2005 07:20:23 GMT
Hi Jim,

I just tried to get adapt my build file to your suggestions, 
but unfortunately I failed....again....
It seems that my antcontrib.jar can be found, but the <for> command is unknown :

C:\ANT-TEST\produktion.xml:80: Could not create task or type of type: for.
Ant could not find the task or a class this task relies upon.

My build file looks like:

<?xml version="1.0" encoding="ISO-8859-1"?>
<project name="Content Produktion" default="GLP_Legislation" basedir=".">
	<taskdef resource="net/sf/antcontrib/antcontrib.properties">
		<classpath>
			<pathelement location="C:\Programme\ant\lib\ant-contrib.jar"/>
		</classpath>
	</taskdef>
	<property name="jar.saxon" location="C:\Programme\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="process_GLP_Legislation" description="Do all XSLT transformations">
		<for param="file">
			<path>
				<fileset dir="source" includes="*.xml"/>
			</path>
			<sequential>
				<transform src="@{file}" dest="added" style="stylesheets/add_versioning_information.xslt"/>
			</sequential>
		</for>
	</target>
</project>



I also set the antcontrib.jar to my classpath.....
Did I use the <for> in a wrong place?

wbr,
Roman


> -----Urspr√ľngliche Nachricht-----
> Von: James Fuller [mailto:jim.fuller@ruminate.co.uk] 
> Gesendet: Dienstag, 12. April 2005 16:18
> An: Ant Users List
> Betreff: Re: AW: Converting new or changed files with an 
> batch file called from within ant
> 
> Huditsch Roman wrote:
> 
> >Hi Jim,
> >
> >Thanks a lot for your solution.
> >I'll straigth dive into it tomorrow morning.
> >Thanks!
> >
> >  
> >
> 
> a few caveats...u have to download ant-contribs jar and make 
> it available to Ant (usually this means putting it in ant's 
> lib...though I would suggest putting into a seperate 
> directory and nesting a <classpath/> to the <taskdef/>)
> 
> this is not tested...though should give you the gist.....
> 
> if you find yourself going the file by file route you could 
> use ant-contribs <for/> task to iterate over a <fileset/>
> 
> <for param="file">
>   <path>
>     <fileset dir="xml" includes="*.xml"/>
>   </path>
>   <sequential>
> 	<transform src="@{file}" dest="dest_dir" 
> style="somestylesheet.xsl"/>
>   </sequential>
> </for>
> 
> note the src would refer to the single file e.g. @{file} (as 
> being itereated through defined by the <fileset/>)
> 
> gl, Jim Fuller
> 
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@ant.apache.org For 
> additional commands, e-mail: user-help@ant.apache.org
> 
> 

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
For additional commands, e-mail: user-help@ant.apache.org


Mime
View raw message