[xsl] Finding unique columns for building a table ...

Subject: [xsl] Finding unique columns for building a table ...
From: "Richard Pugh" <rpugh@xxxxxxxxxxxxxxxxxxx>
Date: Fri, 3 Jun 2005 21:38:15 +0100
Hi all - I've just started using XSLT, so apologies if this is a basic
question.  
I would RTFM but my colleague has TFM so I can't at the moment!  

Anyway, the question:-

I have an XML document that looks like this ...

<?xml version="1.0" encoding="UTF-8"?>
<myRoot>
 <myResults>
  <myOutput Dose="1">
   <timePoint time="1">
    <Value name="P50" Label="Median">1924.836</Value>
    <Value name="P2.5" Label="2.5%">1194.928</Value>
    <Value name="P97.5" Label="97.5%">2598.446</Value>
   </timePoint>
   <timePoint time="2">
    <Value name="P50" Label="Median">1851.636</Value>
    <Value name="P2.5" Label="2.5%">1723.220</Value>
    <Value name="P97.5" Label="97.5%">2024.470</Value>
   </timePoint>
   ...

What I want to do is build a table using 2/3 predefined columns and all
columns I have "value" for at each timePoint (eg. P2.5, P50 and P97.5 in
this case).  So, I want my output to look like this:-

Dose	Time	Median	2.5%		97.5%
1	1	1924.836	1194.928	2598.446
1	2	1851.636	1723.220	2024.470
.

I can see how I could iterate through and build the "rows" of the table
output, but I can't see how I figure out how many columns of values there
are in the first place.  Does anyone have a good approach to finding all
columns (P50, P2.5 and P97.5 in this case), storing that information, then
using that to reference values when iterating through rows?

Many thanks for any help .
Rich.

Current Thread