Re: [xsl] How do I change a XSL style sheet to group data together under one heading

Subject: Re: [xsl] How do I change a XSL style sheet to group data together under one heading
From: "kieters c" <kieters@xxxxxxxxxxx>
Date: Mon, 21 May 2007 12:03:25 +0000
The resuslt I need to get is :

<sample sample_date_time="20061001" cp_name="Neutr. Sump WTPE" imis_cp_ext="2300" dischg_sample_cd=" " sample_comment=" ">
<result rpttime_name="Daily" sis_imis_code="RSP" parm_name="Residue, particulate" >
<result rpttime_name="Daily" sis_imis_code="FTFLOW" parm_name="Flow" />
</sample>


In other words sample_date_time, cp_name, dischg_sample_cd, ect grouped together and the rest grouped with result.


Thank you.


Hennie
From: Abel Braaksma <abel.online@xxxxxxxxx>
Reply-To: xsl-list@xxxxxxxxxxxxxxxxxxxxxx
To: xsl-list@xxxxxxxxxxxxxxxxxxxxxx
Subject: Re: [xsl] How do I change a XSL style sheet to group data together under one heading
Date: Mon, 21 May 2007 12:48:40 +0200


kieters c wrote:
Thank you. I did not see the one although I tried to check on all the brackets. I found another one missing two lines down.

I used XML Notepad 2007 to do the transformation and the result remain the same as previously reported. Only sample_date_time is seperated and all other is include in result. I added all the other that should be grouped with sample_date_time but it made not difference.


I just tried it with the last sample data "flat file" (it is not flat, it is still xml) and changed your sample to contain different groups for the combination sample_date_time and cp_name. It worked perfectly well for me. The sample data I used after I removed some of the noise was this:


<dataroot>
   <sample>
       <sample_date_time>20070101</sample_date_time>
       <cp_name>Neutr. Sump WTPE</cp_name>
       <imis_cp_ext>2300</imis_cp_ext>
       <dischg_sample_cd/>
   </sample>
   <sample>
       <sample_date_time>20070102</sample_date_time>
       <cp_name>Neutr. Sump WTPE</cp_name>
       <imis_cp_ext>2300</imis_cp_ext>
       <dischg_sample_cd/>
   </sample>
   <sample>
       <sample_date_time>20070101</sample_date_time>
       <cp_name>Neutr. Sump WTPE</cp_name>
       <imis_cp_ext>2300</imis_cp_ext>
       <dischg_sample_cd/>
   </sample>
   <sample>
       <sample_date_time>20070101</sample_date_time>
       <cp_name>22Neutr. Sump WTPE</cp_name>
       <imis_cp_ext>2300</imis_cp_ext>
       <dischg_sample_cd/>
   </sample>
   <sample>
       <sample_date_time>20070101</sample_date_time>
       <cp_name>33Neutr. Sump WTPE</cp_name>
       <imis_cp_ext>2300</imis_cp_ext>
       <dischg_sample_cd/>
   </sample>
   <sample>
       <sample_date_time>20070101</sample_date_time>
       <cp_name>22Neutr. Sump WTPE</cp_name>
       <imis_cp_ext>2300</imis_cp_ext>
       <dischg_sample_cd/>
   </sample>
</dataroot>


which returned the following output when run against the stylesheet: (note the added numbers for cp_name attributes to make them distinguishable)


<submission imis_company_code="0001843309" ws_name="LENNOX">
<sample sample_date_time="20070101">
<result cp_name="Neutr. Sump WTPE" imis_cp_ext="2300" dischg_sample_cd=""/>
<result cp_name="Neutr. Sump WTPE" imis_cp_ext="2300" dischg_sample_cd=""/>
</sample>
<sample sample_date_time="20070102">
<result cp_name="Neutr. Sump WTPE" imis_cp_ext="2300" dischg_sample_cd=""/>
</sample>
<sample sample_date_time="20070101">
<result cp_name="22Neutr. Sump WTPE" imis_cp_ext="2300" dischg_sample_cd=""/>
<result cp_name="22Neutr. Sump WTPE" imis_cp_ext="2300" dischg_sample_cd=""/>
</sample>
<sample sample_date_time="20070101">
<result cp_name="33Neutr. Sump WTPE" imis_cp_ext="2300" dischg_sample_cd=""/>
</sample>
</submission>



which, as you can see, is grouped by both sample_date_time and cp_name (i.e., if both are concatenated the same, they are grouped together).


Cheers,
-- Abel Braaksma


_________________________________________________________________
Make free PC-to-PC calls with no loss of life! http://www.communicationevolved.com/en-za/


Current Thread