xsl-list
[Top] [All Lists]

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

2007-12-11 14:22:36
Jérôme,

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



--~------------------------------------------------------------------
XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: <mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--