Re: [xsl] Merging an dynamic set of XML files into 1 with ANT / XSLT ?

Subject: Re: [xsl] Merging an dynamic set of XML files into 1 with ANT / XSLT ?
From: Martin Heiden <martin.heiden@xxxxxxxxxxxxx>
Date: Tue, 11 Dec 2007 22:21:39 +0100
Jirtme,

Tuesday, December 11, 2007, 4:29:26 PM, you wrote:

JH> I have to extract XML elements from a set of XML files, and to
JH> gather these elements into one XML file.
JH> (Let's imagine each XML file is a chapter, and I want to extract
JH> Title element to build the Table Of Contents)
JH> I have to do this using an ANT target.

JH> My main problem is that is must be DYNAMIC : I have to scan the
JH> contents of a folder, sort files alphabetically, and build the TOC according to that.

Wouldn't it be easier to solve this using groovy's ant-task instead of
XSLT?

You could pass the files in a fileset to the groovy-script, parse
those using SAX and generate the TOC. At the end you write the TOC
into a new file.

http://groovy.codehaus.org/The+groovy+Ant+Task
http://groovy.codehaus.org/Reading+XML+with+Groovy+and+SAX
http://groovy.codehaus.org/Creating+XML+using+Groovy%27s+StreamingMarkupBuilder
http://groovy.codehaus.org/Creating+XML+with+Groovy+and+DOM4J
http://groovy.codehaus.org/Input+Output

Just an alternate idea...

regards

  Martin

Current Thread