View Single Post
  #1 (permalink)  
Old June 12th, 2004, 05:22 PM
gurbani gurbani is offline
Registered User
 
Join Date: Jun 2004
Location: Raheen, Limerick, Ireland.
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
Default Multiple XML files matched with common Number Id

Hi,


I'm new to XSLT and I'm strugling trying to get this done. I'd really appreciate any help.

I have multiple sources of XML. There is one file which contains the test definitions (test number, its name, and its unit). The other files contain experiments, etc. per each of these tests. I'm trying to develop an XSLT that transforms this into an HTML table (see below for a simplified example).


XML File 1: definitions.xml

<tests>
- <test number="1">
     <Name>Test 1</Name>
     <Unit>Celsius</Unit>
  </test>
- <test number="2">
  <Name>Test 2</Name>
  <Unit />
  </test>
- <test number="4">
  <Name>Test Blah</Name>
  <Unit>Km</Unit>
  </test>
...
<tests>

----------

XML File 2: experiments.xml
<experiment>
- <temperature value="25degC">
     <test number="1">
        <Sigma>0.23</Sigma>
        <Mean>10.44</Mean>
     </test>
     <test number="3">
        <Sigma>0.13</Sigma>
        <Mean>11.33</Mean>
     </test>
- <temperature value="50degC">
     <test number="1">
        <Sigma>1.22</Sigma>
        <Mean>13.13</Mean>
     </test>
     <test number="2">
        <Sigma>0.16</Sigma>
        <Mean>0.31</Mean>
     </test>
  ....


=======
OUTPUT should be something like this, where tests numbers will be mathched. If it is missing in any side, it'll still be output, but either with the test name/unit missing, or with the experiment data missing>

<table border=1 cellpadding=0>
<thead>
 <tr>
  <td rowspan=2>Test No</td>
  <td rowspan=2>Name</td>
  <td rowspan=2>Unit</td>
  <td colspan=2>25degC</td>
  <td colspan=2>50degC</td>
 </tr>
 <tr>
  <td>Mean</td> <td>Sigma</td> <td>Mean</td> <td>Sigma</td>
 </tr>
 <tr>
</thead>
<tbody>
 <tr>
    <td>1</td> <td>Test 1</td> <td>Celcius</td> <td>0.23</td> <td>10.44</td> <td>1.22</td> <td>13.13</td>
 </tr>
 <tr>
    <td>2</td> <td>Test 2</td> <td></td> <td></td> <td></td> <td>0.16</td> <td>0.31</td>
 </tr>
 <tr>
    <td>3</td> <td></td> <td></td> <td>0.13</td> <td>11.33</td> <td></td> <td></td>
 </tr>
 <tr>
    <td>4</td> <td>Test Blah</td> <td>Km</td> <td></td> <td></td> <td></td> <td></td>
 </tr>
</tbody>
</table




Thanks in advance for your help!

Kind regards,
  Prem

---
Prem Gurbani
Software Engineer,WW Mfg
Analog Devices Inc.
Reply With Quote