ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jful...@ruminate.co.uk
Subject RE: Combine Apply + XSLT task
Date Fri, 26 Nov 2004 15:12:32 GMT
"Robert Soesemann" <rsoesemann@sapient.com> wrote ..
> In the ant-contrib manual is no example for the foreach task. Can
> anybody give an example of how to iterate e.g. over all .xml files in a
> folder structure.
> 
> I also could not find out how to get the path and name of the currently
> iterated file.
> 
> What I need is something like: (pseudocode)
> 
> Foreach file of type **/*.xml in dir X do
>   Store Property path = file + file_path
>   
>   Proccess file with xyz.xsl and store result in dir YXZ
> End do

if you dont want to constrain yourself to calling a target your could do something using the
for

<for param="infile">
  <path>
    <fileset dir="${xslt.dir}" includes="*.xml"/>
  </path>
  <sequential>
 <xslt in="@{infile}" out="@{infile}.html"
      style="xyz.xsl">
  <outputproperty name="method" value="xml";/>
  <outputproperty name="standalone" value="yes"/>
  <outputproperty name="encoding" value="iso8859_1"/>
  <outputproperty name="indent" value="yes"/>
</xslt>
  </sequential>
</for>

untested, but should work.

--Jim Fuller


Mime
View raw message