Found out that I need to use <taskdef resource="net/sf/antcontrib/antlib.xml"/> since otherwise <for> is not supported.
This works fine, but I still have problems with the transformation, since there seems to be a mixup of input files and output directories for Saxon... It seems that the macro is also expecting a directory as input, but getting a file... Can you help me out once again? Thanks a lot for your patience and time! wbr, Roman > -----Ursprüngliche Nachricht----- > Von: Huditsch Roman [mailto:[EMAIL PROTECTED] > Gesendet: Mittwoch, 13. April 2005 09:20 > An: Ant Users List; [EMAIL PROTECTED] > Betreff: AW: AW: Converting new or changed files with an > batch file called from within ant > > 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:[EMAIL PROTECTED] > > 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: [EMAIL PROTECTED] For > additional > > commands, e-mail: [EMAIL PROTECTED] > > > > > > --------------------------------------------------------------------- > To unsubscribe, e-mail: [EMAIL PROTECTED] For > additional commands, e-mail: [EMAIL PROTECTED] > > --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]