Home. 
.

transparent

transparent

transparent

Altova Mailing List Archives


Grouping records

From: "Jeremy Chapman" <NoSpam@------.--->
To: 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>




transparent
Print
Mail
Like It
Disclaimer
.

These Archives are provided for informational purposes only and have been generated directly from the Altova mailing list archive system and are comprised of the lists set forth on www.altova.com/list/index.html. Therefore, Altova does not warrant or guarantee the accuracy, reliability, completeness, usefulness, non-infringement of intellectual property rights, or quality of any content on the Altova Mailing List Archive(s), regardless of who originates that content. You expressly understand and agree that you bear all risks associated with using or relying on that content. Altova will not be liable or responsible in any way for any content posted including, but not limited to, any errors or omissions in content, or for any losses or damage of any kind incurred as a result of the use of or reliance on any content. This disclaimer and limitation on liability is in addition to the disclaimers and limitations contained in the Website Terms of Use and elsewhere on the site.

.
.

transparent

transparent