Re: [xsl] Single output from many inputs

Subject: Re: [xsl] Single output from many inputs
From: "G. Ken Holman" <gkholman@xxxxxxxxxxxxxxxxxxxx>
Date: Tue, 13 Nov 2007 07:26:29 -0500
At 2007-11-13 11:58 +0000, David Sinclair wrote:
I have an ant build file and one of the tasks we need to do is to collect all the elements that have a certain attribute across many files in our code base into one xml file.

Does anyone here know of a way to use XSLT to do this? I had thought to use the xslt ant task to run on all files with a certain extension and collect all the values but I cant find a way to collect the results of each transform into the same file.

       <xslt basedir="${sourcedir}" destdir="${targetdir}"
           style="extract-shared-instances.xsl" includes="**/*.xhtml"
           extension=".xhtml" force="true"/>

Thanks in advance for any assistance you can give me,

You will have to use a single XSLT script that obtains the information from all of the files.


Using XSLT 2.0 will serve you better than the XSLT 1.0 that is in Ant, and Saxon is an example of a Java-based processor that can be invoked from Ant. The collection() function will open all of the files for you.

If you need to stick with XSLT 1.0 there is more effort involved in order to create your list of files in an XML file and then use that XML file as input to the transformation so that you have the filenames to open. The document() function is used to open the other files based on the file names being in the input XML.

I hope this helps.

. . . . . . . . . . . Ken

--
Comprehensive in-depth XSLT2/XSL-FO1.1 classes: Austin TX,Jan-2008
World-wide corporate, govt. & user group XML, XSL and UBL training
RSS feeds:     publicly-available developer resources and training
G. Ken Holman                 mailto:gkholman@xxxxxxxxxxxxxxxxxxxx
Crane Softwrights Ltd.          http://www.CraneSoftwrights.com/s/
Box 266, Kars, Ontario CANADA K0A-2E0    +1(613)489-0999 (F:-0995)
Male Cancer Awareness Nov'07  http://www.CraneSoftwrights.com/s/bc
Legal business disclaimers:  http://www.CraneSoftwrights.com/legal

Current Thread