Altova Mailing List Archives>Archive Index >microsoft.public.xsl Archive Home >Recent entries [Thread Prev] >Thread Next - Re: Grouping records Grouping recordsTo: NULL Date: 12/8/2004 11:54:00 AM I have an xml document that essentially encapsulates records in a dataset.
It contains data for columns, and records and fields within records.
Using my xsl, I am able to output a table style format of the data in html.
I now want to be able to group by a value in one of the fields. I have
included the xml example and xsl below.
Currently my view looks like this:
Name Test Result Result Group Normal Range Range Indicator Units
Test Site Date
Name Test Result Result Group Normal Range Range Indicator Units
Test Site Date
What I want is
Date
Name Test Result Result Group Normal Range Range Indicator Units
Test Site
Name Test Result Result Group Normal Range Range Indicator Units
Test Site
Date
Name Test Result Result Group Normal Range Range Indicator Units
Test Site
The solution is escaping me, as I haven't quite grasped xsl yet. Any help
would be appreciated.
my xsl and xml are below:
Here is an example of my xsl:
<?xml version='1.0'?>
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:output method="html"/>
<xsl:template match="ProviderData/Ts/T[1]">
<style>
TD.Label
{
background-color:#E0E0E0;
border-color:LightSteelBlue;
border-width:1px;
border-style:solid;
font-family:Arial;
}
TD.Field
{
border-color:LightSteelBlue;
border-width:1px;
border-style:solid;
font-family:Arial;
COLOR: black
}
</style>
<table width="98%"><tr><td class="Label"><b><span style="font-size:15">Lab
Results</span></b></td></tr></table>
<table cellpadding="1" width="98%">
<tr>
<td class="Label" width="200"><xsl:value-of
select="Cs/C[1]/@N"></xsl:value-of></td>
<td class="Label" width="60"><xsl:value-of
select="Cs/C[2]/@N"></xsl:value-of></td>
<td class="Label" width="60"><xsl:value-of
select="Cs/C[3]/@N"></xsl:value-of></td>
<td class="Label" width="60"><xsl:value-of
select="Cs/C[4]/@N"></xsl:value-of></td>
<td class="Label" width="60"><xsl:value-of
select="Cs/C[5]/@N"></xsl:value-of></td>
<td class="Label" width="60"><xsl:value-of
select="Cs/C[6]/@N"></xsl:value-of></td>
<td class="Label" width="60"><xsl:value-of
select="Cs/C[7]/@N"></xsl:value-of></td>
<td class="Label" width="60"><xsl:value-of
select="Cs/C[8]/@N"></xsl:value-of></td>
<td class="Label" width="60"><xsl:value-of
select="Cs/C[9]/@N"></xsl:value-of></td>
</tr>
<xsl:for-each select="Rs/R">
<tr>
<xsl:attribute name="style">background-color:
<xsl:if test="position() mod 2 = 1">#EEEEEE</xsl:if>
<xsl:if test="position() mod 2 = 0">Gainsboro</xsl:if>
</xsl:attribute>
<xsl:for-each select="Fs/F">
<td>
<xsl:value-of select="@V"/>
</td>
</xsl:for-each>
</tr>
</xsl:for-each>
</table>
</xsl:template>
</xsl:stylesheet>
Here is an example of my xml:
<?xml version="1.0" encoding="Windows-1252" ?>
<!DOCTYPE ProviderResults (View Source for full doctype...)>
<ProviderData>
<Ts>
<T N="Table">
<Cs>
<C I="0" N="Name" />
<C I="1" N="Test" />
<C I="2" N="Result" />
<C I="3" N="Result Group" />
<C I="4" N="Normal Range" />
<C I="5" N="Range Indicator" />
<C I="6" N="Units" />
<C I="7" N="Test Site" />
<C I="8" N="Date" />
</Cs>
<Rs>
<R I="0">
<Fs>
<F I="0" V="Albumin" />
<F I="1" V="555.1620" />
<F I="2" V="39" />
<F I="3" V="A" />
<F I="4" V="33-53" />
<F I="5" V="" />
<F I="6" V="g/L" />
<F I="7" V="ML" />
<F I="8" V="01/01/2004" />
</Fs>
</R>
<R I="1">
<Fs>
<F I="0" V="Alkaline Phophatase" />
<F I="1" V="111.1850" />
<F I="2" V="119" />
<F I="3" V="A" />
<F I="4" V="43-122" />
<F I="5" V="" />
<F I="6" V="U/L" />
<F I="7" V="ML" />
<F I="8" V="01/01/2004" />
</Fs>
</R>
<R I="1">
<Fs>
<F I="0" V="Alkaline Phophatase" />
<F I="1" V="000.1800" />
<F I="2" V="119" />
<F I="3" V="B" />
<F I="4" V="43-122" />
<F I="5" V="" />
<F I="6" V="U/L" />
<F I="7" V="ML" />
<F I="8" V="01/01/2005" />
</Fs>
</R>
</Rs>
</T>
</Ts>
</ProviderData>
| ||||||
| Company | Legal | Press | Partners | Careers | Sitemap | Contact Us | Altova Blog | Mobile | Full Site | |||
|
