Ant task to transform all files in a folder

Having trouble installing Oxygen? Got a bug to report? Post it all here.
martindholmes
Posts: 176
Joined: Wed Apr 20, 2005 5:43 pm
Location: Victoria, BC, Canada

Ant task to transform all files in a folder

Post by martindholmes »

I'm having trouble getting a fairly simple Ant task to work. I'm trying to run an XSLT transformation on all the files in a folder and output the results to another folder. This is what the relevant bit of the build file looks like at the moment:

Code: Select all


  <target name="poemsToHTML">
<echo>Create output for all poems in the anthology folder.</echo>
<xslt force="true" style="${pd}/xsl/poem.xsl" includes="${pd}/anthology" basedir="${pd}/xsl" destdir="${pd}/html" extension=".html" scanincludeddirectories="true">
<factory name="net.sf.saxon.TransformerFactoryImpl"/>
<classpath location="${oxygenlib}/saxon9ee.jar"/>
</xslt>
</target>
I get this output in the console, but nothing is created:

Code: Select all

poemsToHTML:
[echo]Create output for all poems in the anthology folder.
[xslt] Transforming into /media/Data/mholmes/Documents/english/VictorianPoetryNetwork/svnrepo/html
According to how I read the Ant docs, this should scan the included directory (anthology) and process all of the files in it.

Can anyone see what I'm missing?
martindholmes
Posts: 176
Joined: Wed Apr 20, 2005 5:43 pm
Location: Victoria, BC, Canada

Re: Ant task to transform all files in a folder

Post by martindholmes »

Answering my own question, in case it helps someone else. I had to use a fileset:

Code: Select all


    <fileset id="anthologyFiles" dir="${pd}/anthology" includes="*.xml"></fileset>

<xslt force="true" style="${pd}/xsl/poem.xsl" destdir="${pd}/html" extension=".html" useImplicitFileset="false">
<fileset refid="anthologyFiles"/>
<factory name="net.sf.saxon.TransformerFactoryImpl"/>
<classpath location="${oxygenlib}/saxon9ee.jar"/>
</xslt>
Radu
Posts: 9018
Joined: Fri Jul 09, 2004 5:18 pm

Re: Ant task to transform all files in a folder

Post by Radu »

Hi Martin,

Thanks for updating the post with a solution.

Regards,
Radu
Radu Coravu
<oXygen/> XML Editor
http://www.oxygenxml.com
Post Reply