Subject: RE: [xsl] How do I change a XSL style sheet to group data together under one heading From: "kieters c" <kieters@xxxxxxxxxxx> Date: Thu, 17 May 2007 12:40:32 +0000 |
<?xml version="1.0"?> <!DOCTYPE submission [<!ELEMENT submission (sample*)> <!ATTLIST submission imis_company_code CDATA #REQUIRED ws_name CDATA #IMPLIED>
<!ELEMENT sample (result*)> <!ATTLIST sample sample_date_time CDATA #REQUIRED imis_cp_ext CDATA #REQUIRED cp_name CDATA #IMPLIED dischg_sample_cd CDATA #REQUIRED sample_comment CDATA #REQUIRED>
<!ELEMENT result EMPTY> <!ATTLIST result rpttime_name CDATA #REQUIRED sis_imis_code CDATA #REQUIRED parm_name CDATA #IMPLIED unit_abbrev CDATA #REQUIRED rptas_abbrev CDATA #REQUIRED result_structure CDATA #REQUIRED component_type CDATA #REQUIRED result_value CDATA #REQUIRED remark_code_1 CDATA #IMPLIED remark_code_2 CDATA #IMPLIED remark_code_3 CDATA #IMPLIED result_comment CDATA #IMPLIED imis_regulation_code_1 CDATA #REQUIRED imis_regulation_code_2 CDATA #IMPLIED
<?xml version="1.0" encoding="UTF-8" ?> -<dataroot> -<sample> <imis_company_code>0001843309</imis_company_code> <ws_name>LENNOX</ws_name> <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_comment/> <rpttime_name>DAILY</rpttime_name> <sis_imis_code>FTFLOW</sis_imis_code> <parm_name>FLOW</parm_name> <Unit_abbrev>M3/D</Unit_abbrev> <rptas_abbrev>NOT APPL</rptas_abbrev> <result_structure>SI</result_structure> <component_type>SM</component_type> <result_value>168.2</result_value> <remark_code_1/> <remark_code_2/> <remark_code_3/> <result_comment/> <imis_regulation_code_1>MC</imis_regulation_code_1> <imis_regulation_code_2>CA</imis_regulation_code_2> </sample> -<sample> <imis_company_code>0001843309</imis_company_code> <ws_name>LENNOX</ws_name> <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_comment/> <rpttime_name>DAILY</rpttime_name> <sis_imis_code>ph</sis_imis_code> <parm_name>PH (-LOG H+ CONCN)</parm_name> <Unit_abbrev>NO DIM</Unit_abbrev> <rptas_abbrev>NOT APPL</rptas_abbrev> <result_structure>P3</result_structure> <component_type>V1</component_type> <result_value>8.2</result_value> <remark_code_1/> <remark_code_2/> <remark_code_3/> <result_comment/> <imis_regulation_code_1>MC</imis_regulation_code_1> <imis_regulation_code_2/> </sample> -<sample> <imis_company_code>0001843309 </imis_company_code> <ws_name>LENNOX</ws_name> <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_comment/> <rpttime_name>DAILY</rpttime_name> <sis_imis_code>pH</sis_imis_code> <parm_name>PH (-LOG H+ CONCN)</parm_name> <Unit_abbrev>NO DIM</Unit_abbrev> <rptas_abbrev>NOT APPL</rptas_abbrev> <result_structure>P3</result_structure> <component_type>T1</component_type> <result_value>08:00</result_value> <remark_code_1/> <remark_code_2/> <remark_code_3/> <result_comment/> <imis_regulation_code_1>MC</imis_regulation_code_1> <imis_regulation_code_2/> </sample> -</dataroot>
From: "Bjorndahl, Brad" <brad.bjorndahl@xxxxxxxxxxxxxxxx>
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: Wed, 16 May 2007 15:38:35 -0400
Hi,
A few things:
- You have not shown the source XML, so it is not possible to give good advice on how to transform it.
- Change your UC variable to be upper case in fact.
- Change the 'remark_code_3' attribute to reference the remark_code_3 value instead of remark_code_2 as you had.
Brad
-----Original Message----- From: kieters c [mailto:kieters@xxxxxxxxxxx] Sent: May 16, 2007 2:20 PM To: xsl-list@xxxxxxxxxxxxxxxxxxxxxx Subject: [xsl] How do I change a XSL style sheet to group data together under one heading
Good day, My knowledge of XML is next to none and I only have one XSL code to use. I also assume I may be using incorrect jargon and hope you will understand what I need.
I have an XSL style sheet to convert the XML flat file. I need to change the style sheet so it groups certain data together under one heading. I need to be able to do this as the system I upload the file to do not accept the information as presented and continuously gives me an error. What I am trying to say is that the "result" information under "sample" grouped together where the "sample" information is the same.
Your assistance is much appreciated.
Thank you.
Hennie
The format it requires is as follow:
<sample sample_date_time="20070101" imis_cp_ext="2300" cp_name="NEUTRA. SUMP WTPE" dischg_sample_cd="20070101" sample_comment=""> <result rpttime_name="DAILY" sis_imis_code="FTFLOW" parm_name="FLOW" result_structure="SI" unit_abbrev="M3/D" rptas_abbrev="NOT APPL" component_type="SM" result_value="170.000000" result_comment="" imis_regulation_code_1="CA" imis_regulation_code_2="MC" /> <result rpttime_name="DAILY" sis_imis_code="PH" parm_name="PH (-LOG H+ CONCN)" result_structure="P3" unit_abbrev="NO DIM" rptas_abbrev="NOT APPL" component_type="V1" result_value="8.246000" result_comment="" imis_regulation_code_1="MC" /> <result rpttime_name="DAILY" sis_imis_code="PH" parm_name="PH (-LOG H+ CONCN)" result_structure="P3" unit_abbrev="NO DIM" rptas_abbrev="NOT APPL" component_type="T1" result_value="08:00" result_comment="" imis_regulation_code_1="MC" /> <result rpttime_name="DAILY" sis_imis_code="PH" parm_name="PH (-LOG H+ CONCN)" result_structure="P3" unit_abbrev="NO DIM" rptas_abbrev="NOT APPL" component_type="V2" result_value="8.233000" result_comment="" imis_regulation_code_1="MC" /> <result rpttime_name="DAILY" sis_imis_code="PH" parm_name="PH (-LOG H+ CONCN)" result_structure="P3" unit_abbrev="NO DIM" rptas_abbrev="NOT APPL" component_type="T2" result_value="12:00" result_comment="" imis_regulation_code_1="MC" /> <result rpttime_name="DAILY" sis_imis_code="PH" parm_name="PH (-LOG H+ CONCN)" result_structure="P3" unit_abbrev="NO DIM" rptas_abbrev="NOT APPL" component_type="V3" result_value="8.216000" result_comment="" imis_regulation_code_1="MC" /> <result rpttime_name="DAILY" sis_imis_code="PH" parm_name="PH (-LOG H+ CONCN)" result_structure="P3" unit_abbrev="NO DIM" rptas_abbrev="NOT APPL" component_type="T3" result_value="16:00" result_comment="" imis_regulation_code_1="MC" /> <result rpttime_name="DAILY" sis_imis_code="RSP" parm_name="RESIDUE,PARTICULATE" result_structure="SI" unit_abbrev="MG/L" rptas_abbrev="NOT APPL" component_type="SM" result_value="3.38" result_comment="" imis_regulation_code_1="CA" imis_regulation_code_2="MC" /> </sample>
The one generated by the XSL style sheet is as follow.: Only a few records posted
- <sample sample_date_time="20070101" imis_cp_ext="2300" cp_name="Neutr. Sump WTPE" dischg_sample_cd="" sample_comment=""> <result rpttime_name="DAILY" sis_imis_code="FTFLOW" parm_name="Flow" unit_abbrev="M3/D" rptas_abbrev="NOT APPL" result_structure="SI" component_type="SM" result_value="168.2" remark_code_1="" remark_code_2="" remark_code_3="" result_comment="" imis_regulation_code_1="MC" imis_regulation_code_2="CA" /> </sample> - <sample sample_date_time="20070101" imis_cp_ext="2300" cp_name="Neutr. Sump WTPE" dischg_sample_cd="" sample_comment=""> <result rpttime_name="DAILY" sis_imis_code="PH" parm_name="pH (-log H+ Concn)" unit_abbrev="NO DIM" rptas_abbrev="NOT APPL" result_structure="P3" component_type="V1" result_value="8.2" remark_code_1="" remark_code_2="" remark_code_3="" result_comment="" imis_regulation_code_1="MC" imis_regulation_code_2="" /> </sample> - <sample sample_date_time="20070101" imis_cp_ext="2300" cp_name="Neutr. Sump WTPE" dischg_sample_cd="" sample_comment=""> <result rpttime_name="DAILY" sis_imis_code="PH" parm_name="pH (-log H+ Concn)" unit_abbrev="NO DIM" rptas_abbrev="NOT APPL" result_structure="P3" component_type="T1" result_value="08:00" remark_code_1="" remark_code_2="" remark_code_3="" result_comment="" imis_regulation_code_1="MC" imis_regulation_code_2="" /> </sample> - <sample sample_date_time="20070101" imis_cp_ext="2300" cp_name="Neutr. Sump WTPE" dischg_sample_cd="" sample_comment=""> <result rpttime_name="DAILY" sis_imis_code="PH" parm_name="pH (-log H+ Concn)" unit_abbrev="NO DIM" rptas_abbrev="NOT APPL" result_structure="P3" component_type="V2" result_value="8.17" remark_code_1="" remark_code_2="" remark_code_3="" result_comment="" imis_regulation_code_1="MC" imis_regulation_code_2="" /> </sample> - <sample sample_date_time="20070101" imis_cp_ext="2300" cp_name="Neutr. Sump WTPE" dischg_sample_cd="" sample_comment=""> <result rpttime_name="DAILY" sis_imis_code="PH" parm_name="pH (-log H+ Concn)" unit_abbrev="NO DIM" rptas_abbrev="NOT APPL" result_structure="P3" component_type="T2" result_value="12:00" remark_code_1="" remark_code_2="" remark_code_3="" result_comment="" imis_regulation_code_1="MC" imis_regulation_code_2="" /> </sample> The style sheet is : <?xml version="1.0" encoding="iso-8859-1" ?> - <!-- sample.xsl --> - <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0"> <xsl:output method="xml" indent="yes" /> - <xsl:variable name="UC"> <xsl:text>abcdefghijklmnopqrstuvwxyz</xsl:text> </xsl:variable> - <xsl:variable name="lc"> <xsl:text>abcdefghijklmnopqrstuvwxyz</xsl:text> </xsl:variable> - <xsl:template match="/"> - <submission imis_company_code="0001843309" ws_name=" "> <xsl:apply-templates /> </submission> </xsl:template> - <xsl:template match="sample"> - <sample sample_date_time="{sample_date_time}" imis_cp_ext="{imis_cp_ext}" cp_name="{cp_name}" dischg_sample_cd="{dischg_sample_cd}" sample_comment="{sample_comment}"> <result rpttime_name="{translate(rpttime_name,$lc,$UC)}" sis_imis_code="{translate(sis_imis_code,$lc,$UC)}" parm_name="{parm_name}" unit_abbrev="{Unit_abbrev}" rptas_abbrev="{rptas_abbrev}" result_structure="{result_structure}" component_type="{component_type}" result_value="{result_value}" remark_code_1="{remark_code_1}" remark_code_2="{remark_code_2}" remark_code_3="{remark_code_2}" result_comment="{result_comment}" imis_regulation_code_1="{imis_regulation_code_1}" imis_regulation_code_2="{imis_regulation_code_2}" /> </sample> </xsl:template> </xsl:stylesheet>
_________________________________________________________________ Share folders without harming wildlife! http://www.communicationevolved.com/en-za/
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
RE: [xsl] How do I change a XSL sty, Bjorndahl, Brad | Thread | Re: [xsl] How do I change a XSL sty, Abel Braaksma |
RE: [xsl] How do I change a XSL sty, kieters c | Date | Re: [xsl] Extract input filename, Abel Braaksma |
Month |