ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Robert Soesemann" <rsoesem...@sapient.com>
Subject RE: foreach parameter does not change
Date Fri, 26 Nov 2004 16:45:25 GMT
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:billrich@attglobal.net] 
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:rsoesemann@sapient.com] 
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: 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


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


Mime
View raw message