I'm sorry. That didn't help. My mistake was that I called the xslt task
in a way that he recursivly iterated over the directory itself. 

Now I have another problem. $file is an absolute filepath, which can't
be processed correctly by the xslt task. I don't know what to put in the
out attribute.
Can I rewritte that to work with relative paths?

I now changed it to:
--------------------
    <target name="8_AddUniqueIds">
        <foreach target="8_sub" param="file" >
                <path>
                        <fileset dir="${xs_dir}" includes="**/*.xml"/>
                </path>
        </foreach>
    </target>   
        
        <target name="8_sub">
                <echo message="${file}"/> <<--- IS AN ABSOLUTE PATH
C:\...\foo.xml

                <xslt in="${file}" out="????" style="add-unique-id.xsl">
                        <param name="file" expression="${file}"/>
                </xslt>
        </target>

-----Original Message-----
From: Bill Rich [mailto:[EMAIL PROTECTED] 
Sent: Freitag, 26. November 2004 17:29
To: 'Ant Users List'
Subject: RE: foreach parameter does not change


In 8_sub use @{file} to access the parameter. HTH

Bill 

-----Original Message-----
From: Robert Soesemann [mailto:[EMAIL PROTECTED] 
Sent: Friday, November 26, 2004 7:46 AM
To: Ant Users List
Subject: foreach parameter does not change

Hello,

In my ant pipeline I have the following 2 targets which perform a
foreach on every xml file in a folder structure. I do it this way to
pass the path of the currently process file to the xsl transformer.
Although the code looks like $file is overwritten each iteration, all my
xmls get the same file parameter.

Any ideas?!

   <!-- ================ Target 8: AddUniqueId  ================ -->
    <target name="8_AddUniqueId" depends="6_AddSchemaDefinitions">
        
        <!-- Iterate over all xml files and include path as id via xslt
-->
        <foreach target="8_sub" param="file" >
                <path>
                        <fileset dir="${xs_dir}" includes="**/*.xml"/>
                </path>
        </foreach>
    </target>   
        
        <!-- Internal subtask call by foreach iterator in target 8 -->
        <target name="8_sub">
                <xslt in="${file}" 
                          basedir="${xs_dir}" 
                          destdir="${id_dir}"
                          style="add-unique-id.xsl"
                          extension=".xml">
                        <param name="path" expression="${file}"/> <<----
IT
NEVER CHANGES
                </xslt>
        </target>

Robert

---------------------------------------------------------------------
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]

Reply via email to