Ant task to transform all files in a folder

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

Ant task to transform all files in a folder

Post by martindholmes » Thu Jun 26, 2014 11:54 pm

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: 150
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 » Fri Jun 27, 2014 12:30 am

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: 6979
Joined: Fri Jul 09, 2004 5:18 pm

Re: Ant task to transform all files in a folder

Post by Radu » Fri Jun 27, 2014 8:19 am

Hi Martin,

Thanks for updating the post with a solution.

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

Post Reply