Can ant build.xml build target from a variable anount of input files

Wednesday, November 4, 2015

First excuse my bad English.



Here is the concept:
I have to implement multiple xslt transformations.
How many transformations shall be executed, depends on how many xml files will be in a separate directory/folder. So the problem is: How to tetll the build.xml (the ant build file) to do a loop that iterates a task for each file in a directory.
This is meta code is an attempt to describe the idea:



 foreach(test-cases/*.xml)
{
<xslt
in="." out="report_(n+1).xml" style="ConstantStylesheet.xslt">
</xslt>
}


The stylesheet will not change per transformations, only the input and the output files.



in="." refers to the coherent xml file as an input for the xslt processor.



report_${.}.xml is to tell the processor that the output file name will be suffixed with subsequent name of the input file.
If I specify same output for each transformation the output file will be overwritten each iteration.
If it is not possible in build.xml(the ant script), any ideas are very much wellcome.

0 comments:

Post a Comment