Click to See Complete Forum and Search --> : Format xml grouping by date??????


dallasweb
04-14-2003, 03:53 PM
Hello all,

Here is my xml doc and desired output. I'm pretty new to using xslt and this has really stumped me. So any help is appreciated.

XML:
<VitalSignsComponent>
<patient_info>
<vitals>
<type>bp</type>
<date>04/14/2003</date>
<time>13:15:00</time>
<sys_value>157</sys_value>
<dia_value>99</dia_value>
<mean_value>118</mean_value>
</vitals>
<vitals>
<type>bp</type>
<date>04/14/2003</date>
<time>13:30:00</time>
<sys_value>145</sys_value>
<dia_value>94</dia_value>
<mean_value>111</mean_value>
</vitals>
<vitals>
<type>bp</type>
<date>04/14/2003</date>
<time>13:45:00</time>
<sys_value>150</sys_value>
<dia_value>89</dia_value>
<mean_value>109</mean_value>
</vitals>
<vitals>
<type>hr</type>
<date>04/14/2003</date>
<time>13:15:00</time>
<value>63</value>
</vitals>
<vitals>
<type>hr</type>
<date>04/14/2003</date>
<time>13:30:00</time>
<value>77</value>
</vitals>
<vitals>
<type>hr</type>
<date>04/14/2003</date>
<time>13:45:00</time>
<value>78</value>
</vitals>
<vitals>
<type>temp</type>
<date>04/14/2003</date>
<time>13:15:00</time>
<c_value> 36.6</c_value>
<f_value> 97.9</f_value>
</vitals>

<vitals>
<type>o2</type>
<date>04/14/2003</date>
<time>13:15:00</time>
<value>98</value>
</vitals>
<vitals>
<type>resp</type>
<date>04/14/2003</date>
<time>13:15:00</time>
<value>20</value>
</vitals>
</patient_info>
<utility>
<hours>12</hours>
</utility>
</VitalSignsComponent>

Output:
<table cellspacing="2" cellpadding="2" border="1">
<tr>
<td>&nbsp;</td>
<td>04/14/2003 - 13:15:00</td>
<td>04/14/2003 - 13:30:00</td>
<td>04/14/2003 - 13:45:00</td>
</tr>
<tr>
<td>BP</td>
<td>157/99 118</td>
<td>145/94 111</td>
<td>150/89 109</td>
</tr>
<tr>
<td>HR</td>
<td>63</td>
<td>77</td>
<td>78</td>
</tr>
<tr>
<td>RESP</td>
<td>&nbsp;</td>
<td>&nbsp;</td>
<td>20</td>
</tr>
<tr>
<td>o2</td>
<td>98</td>
<td>&nbsp;</td>
<td>&nbsp;</td>
</tr>
<tr>
<td>Temp</td>
<td>97.9f 36.6c</td>
<td>&nbsp;</td>
<td>&nbsp;</td>
</tr>
</table>

khalidali63
04-15-2003, 09:36 AM
solution to your question is time consuming,I think if you have partial question that will probably be answered sooner.People answer questions here volunteerily,creating complete solutions if its time consuming, might not be something people want to do.

Cheers

Khalid

dallasweb
04-15-2003, 09:45 AM
Fair enough.

If someone could point me in the right direction.....

I need to create the above output based on the xml. Is the xml formatted in such a way that this is even possible? If it is how would you go about grouping by date/time? Create a choose or if loop and do what???? I'm not asking for anyone to do this work for me just some direction, any help is appreciated. Hopefully as I get more proficient at XSLT I'll be able to offer some help to others as well.

THANKS

khalidali63
04-15-2003, 09:52 AM
ok here is the logic as I'd follow,forgive me my xsl/xslt skills are 3 yrs old..:-)

First create the table headers with date+time values

look into for-each loops in xsl for vitals element
once that is done

next is to create first item in vitals group which is bp
then the other and so on
table
tr
<xsl:for-each select = "//vitals">
<td>
<xsl:value-of select="date"/> - <xsl:value-of select="time"/>

</td>
/tr
here you go again for each vitals and get the rest of the values

hope this helps

Cheers

Khalid