How to use xslt to read multiple (directory full) xml files and generate one output file.

EDN Admin

Well-known member
Joined
Aug 7, 2010
Messages
12,794
Location
In the Machine
Gday,
Ive got an Vb.2005 windows forms xml based application that generates and consumes XML files.  So far Ive uses XSLT files to transform those xml files in a one xml file to one output file senario.  XSLT is painful to write, but eventually I get a solution.
Im completely stuck on how to use multiple xml files, ( for example all the files in a directory) to then generate one output file via xslt.  I know Ive got to use the Select="Document(???)" and or some variables but I cant seem to get a good example that doesnt rely on another xml file to provide the paths to those documents.
Eg. Nunit 2.2 has an xml results file formated the following way, and I want to read the results of my nightly unit tests results and place it into a single results file called "All_Unit_test_failureResults.html" <font color="#0000ff" size=2>
<?</font><font color="#800000" size=2>xml</font><font color="#0000ff" size=2> </font><font color="#ff0000" size=2>version</font><font color="#0000ff" size=2>=</font><font size=2>"</font><font color="#0000ff" size=2>1.0</font><font size=2>"</font><font color="#0000ff" size=2> </font><font color="#ff0000" size=2>encoding</font><font color="#0000ff" size=2>=</font><font size=2>"</font><font color="#0000ff" size=2>utf-8</font><font size=2>"</font><font color="#0000ff" size=2> </font><font color="#ff0000" size=2>standalone</font><font color="#0000ff" size=2>=</font><font size=2>"</font><font color="#0000ff" size=2>no</font><font size=2>"</font><font color="#0000ff" size=2>?>
<!--</font><font color="#008000" size=2>This file represents the results of running a test suite</font><font color="#0000ff" size=2>-->
<</font><font color="#800000" size=2>test-results</font><font color="#0000ff" size=2> </font><font color="#ff0000" size=2>name</font><font color="#0000ff" size=2>=</font><font size=2>"</font><font color="#0000ff" size=2>D:CustomersExample.dll</font><font size=2>"</font><font color="#0000ff" size=2> </font><font color="#ff0000" size=2>total</font><font color="#0000ff" size=2>=</font><font size=2>"</font><font color="#0000ff" size=2>12</font><font size=2>"</font><font color="#0000ff" size=2> </font><font color="#ff0000" size=2>failures</font><font color="#0000ff" size=2>=</font><font size=2>"</font><font color="#0000ff" size=2>1</font><font size=2>"</font><font color="#0000ff" size=2> </font><font color="#ff0000" size=2>not-run</font><font color="#0000ff" size=2>=</font><font size=2>"</font><font color="#0000ff" size=2>0</font><font size=2>"</font><font color="#0000ff" size=2> </font><font color="#ff0000" size=2>date</font><font color="#0000ff" size=2>=</font><font size=2>"</font><font color="#0000ff" size=2>17/02/2005</font><font size=2>"</font><font color="#0000ff" size=2> </font><font color="#ff0000" size=2>time</font><font color="#0000ff" size=2>=</font><font size=2>"</font><font color="#0000ff" size=2>8:53 PM</font><font size=2>"</font><font color="#0000ff" size=2>></font> <font color="#0000ff" size=2><font color="#0000ff" size=2>
</</font><font color="#800000" size=2>test-results</font><font color="#0000ff" size=2>></font><font color="#0000ff" size=2> </font></font>
In this case I dont really want to use any of the dot net framework specific code as I want to use the same technique in a nightly build process (Nant 0.85 currently) .  I use the <style> task in Nant and effectively have a similar function in my application.
So is this possible and could someone provide a simple example of such a transformation?

View the full article
 
Back
Top