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: Abel Braaksma <abel.online@xxxxxxxxx>
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

Current Thread