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_tim e="20070101" imis_cp_ext="23 00" cp_name="NEUTRA .
SUMP WTPE" dischg_sample_c d="20070101" sample_comment= "">
<result rpttime_name="D AILY" sis_imis_code=" FTFLOW" parm_name="FLOW "
result_structur e="SI" unit_abbrev="M3/D" rptas_abbrev="N OT APPL"
component_type= "SM" result_value="1 70.000000" result_comment= ""
imis_regulation _code_1="CA" imis_regulation _code_2="MC" />
<result rpttime_name="D AILY" sis_imis_code=" PH" parm_name="PH (-LOG H+
CONCN)" result_structur e="P3" unit_abbrev="NO DIM" rptas_abbrev="N OT
APPL" component_type= "V1" result_value="8 .246000" result_comment= ""
imis_regulation _code_1="MC" />
<result rpttime_name="D AILY" sis_imis_code=" PH" parm_name="PH (-LOG H+
CONCN)" result_structur e="P3" unit_abbrev="NO DIM" rptas_abbrev="N OT
APPL" component_type= "T1" result_value="0 8:00" result_comment= ""
imis_regulation _code_1="MC" />
<result rpttime_name="D AILY" sis_imis_code=" PH" parm_name="PH (-LOG H+
CONCN)" result_structur e="P3" unit_abbrev="NO DIM" rptas_abbrev="N OT
APPL" component_type= "V2" result_value="8 .233000" result_comment= ""
imis_regulation _code_1="MC" />
<result rpttime_name="D AILY" sis_imis_code=" PH" parm_name="PH (-LOG H+
CONCN)" result_structur e="P3" unit_abbrev="NO DIM" rptas_abbrev="N OT
APPL" component_type= "T2" result_value="1 2:00" result_comment= ""
imis_regulation _code_1="MC" />
<result rpttime_name="D AILY" sis_imis_code=" PH" parm_name="PH (-LOG H+
CONCN)" result_structur e="P3" unit_abbrev="NO DIM" rptas_abbrev="N OT
APPL" component_type= "V3" result_value="8 .216000" result_comment= ""
imis_regulation _code_1="MC" />
<result rpttime_name="D AILY" sis_imis_code=" PH" parm_name="PH (-LOG H+
CONCN)" result_structur e="P3" unit_abbrev="NO DIM" rptas_abbrev="N OT
APPL" component_type= "T3" result_value="1 6:00" result_comment= ""
imis_regulation _code_1="MC" />
<result rpttime_name="D AILY" sis_imis_code=" RSP"
parm_name="RESI DUE,PARTICULATE " result_structur e="SI" unit_abbrev="MG/L"
rptas_abbrev="N OT 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_tim e="20070101" imis_cp_ext="23 00" cp_name="Neutr.
Sump WTPE" dischg_sample_c d="" sample_comment= "">
<result rpttime_name="D AILY" sis_imis_code=" FTFLOW" parm_name="Flow "
unit_abbrev="M3/D" rptas_abbrev="N OT APPL" result_structur e="SI"
component_type= "SM" result_value="1 68.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_tim e="20070101" imis_cp_ext="23 00" cp_name="Neutr.
Sump WTPE" dischg_sample_c d="" sample_comment= "">
<result rpttime_name="D AILY" sis_imis_code=" PH" parm_name="pH (-log H+
Concn)" unit_abbrev="NO DIM" rptas_abbrev="N OT APPL"
result_structur e="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_tim e="20070101" imis_cp_ext="23 00" cp_name="Neutr.
Sump WTPE" dischg_sample_c d="" sample_comment= "">
<result rpttime_name="D AILY" sis_imis_code=" PH" parm_name="pH (-log H+
Concn)" unit_abbrev="NO DIM" rptas_abbrev="N OT APPL"
result_structur e="P3" component_type= "T1" result_value="0 8: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_tim e="20070101" imis_cp_ext="23 00" cp_name="Neutr.
Sump WTPE" dischg_sample_c d="" sample_comment= "">
<result rpttime_name="D AILY" sis_imis_code=" PH" parm_name="pH (-log H+
Concn)" unit_abbrev="NO DIM" rptas_abbrev="N OT APPL"
result_structur e="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_tim e="20070101" imis_cp_ext="23 00" cp_name="Neutr.
Sump WTPE" dischg_sample_c d="" sample_comment= "">
<result rpttime_name="D AILY" sis_imis_code=" PH" parm_name="pH (-log H+
Concn)" unit_abbrev="NO DIM" rptas_abbrev="N OT APPL"
result_structur e="P3" component_type= "T2" result_value="1 2: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:styleshe et xmlns:xsl="http ://www.w3.org/1999/XSL/Transform"
version="1.0">
<xsl:output method="xml" indent="yes" />
- <xsl:variable name="UC">
<xsl:text>ABCDE FGHIJKLMNOPQRST UVWXYZ</xsl:text>
</xsl:variable>
- <xsl:variable name="lc">
<xsl:text>abcde fghijklmnopqrst uvwxyz</xsl:text>
</xsl:variable>
- <xsl:template match="/">
- <submission imis_company_co de="0001843309 " ws_name=" ">
<xsl:apply-templates />
</submission>
</xsl:template>
- <xsl:template match="sample">
- <sample sample_date_tim e="{sample_date _time}"
imis_cp_ext="{i mis_cp_ext}" cp_name="{cp_na me}"
dischg_sample_c d="{dischg_samp le_cd}" sample_comment= "{sample_commen t}">
<result rpttime_name="{ translate(rptti me_name,$lc,$UC )}"
sis_imis_code=" {translate(sis_ imis_code,$lc,$ UC)}"
parm_name="{par m_name}" unit_abbrev="{U nit_abbrev}"
rptas_abbrev="{ rptas_abbrev}" result_structur e="{result_stru cture}"
component_type= "{component_typ e}" 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_commen t}"
imis_regulation _code_1="{imis_ regulation_code _1}"
imis_regulation _code_2="{imis_ regulation_code _2}" />
</sample>
</xsl:template>
</xsl:stylesheet>
*** Sent via Developersdex
http://www.developersdex.com ***