[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

Re: How do I change a XSL style sheet to group data t

Subject: Re: 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 08:32:22 +0000
Re:  How do I change a XSL style sheet to group data  t
Good day,

Thank you for your reply. I am aware of the one entry and have tried to run it with it as presented to you and without it with only sample_date_time. The result is the same. I receive the message for the following line:

<xsl:for-each select="sample[generate-id() = generate-id(key('sample',concat(sample_date_time, cp_name)[1])]">

line 15, Character 23
Stylesheet error: Invalid XPath expression
select

You will also notice from the produced result extract, the following appears in the same line as sample_date_time

xmlns:od="urn:schemas-microsoft-com:officedata". This is due to the dataroot entry from the flatfile and is created while the creating the flatfile from Access 2000.

Thank you for your valueable time.

Hennie


Required output


<?xml version="1.0" encoding="utf-8" ?>
<submission imis_company_code="0001843309" ws_name="LENNOX TGS">
<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"/>
</sample>


Produced result

<?xml version="1.0" encoding="utf-8" ?>
<submission imis_company_code="0001843309" ws_name="LENNOX"> <sample sample_date_time="20070101"


xmlns:od="urn:schemas-microsoft-com:officedata"> ==> due to dataroot. Very first entry in flat file. Repeated with every sample_date_time.

<result cp_name="Neutr. Sump WTPE" imis_cp_ext="2300" dischg_sample_cd="" sample_comment="" 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" result_comment="" imis_regulation_code_1="MC />
<result cp_name="Neutr. Sump WTPE" imis_cp_ext="2300" dischg_sample_cd="" sample_comment="" 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" result_comment="" imis_regulation_code_1="MC" />
</sample>


<sample sample_date_time="20070102" xmlns:od="urn:schemas-microsoft-com:officedata">
<result cp_name="Neutr. Sump WTPE" imis_cp_ext="2300" dischg_sample_cd="" sample_comment="" 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="203.5" result_comment="" imis_regulation_code_1="MC" />
<result cp_name="Neutr. Sump WTPE" imis_cp_ext="2300" dischg_sample_cd="" sample_comment="" 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="7.82" result_comment="" imis_regulation_code_1="MC" />
</sample>


Flat file

<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_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>
    <result_comment/>
    <imis_regulation_code_1>MC</imis_regulation_code_1>
    <imis_regulation_code_2>CA</imis_regulation_code_2>
 </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_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>
    <result_comment/>
    <imis_regulation_code_1>MC</imis_regulation_code_1>
    <imis_regulation_code_2/>
 </sample>
</dataroot>


From: Abel Braaksma <abel.online@xxxxxxxxx>
Reply-To: xsl-list@xxxxxxxxxxxxxxxxxxxxxx
To: xsl-list@xxxxxxxxxxxxxxxxxxxxxx
Subject: Re: How do I change a XSL style sheet to group data together under one heading
Date: Fri, 18 May 2007 19:37:17 +0200


kieters c wrote:

Good day,


Thank you for the information. I have changed it accordingly and nothing seems to happen. I have checked to see if I did everything, checked for any inconsistancies like an extra bracket but still nothing happened. I replace every instance of "sample_date_time" with "concat(sample_date_time, cp_name)".



<!-- match the sample's that are grouped -->
<xsl:template match="sample">
<result>
<xsl:apply-templates select="*[not(self::concat(sample_date_time, cp_name))]" />
</result>
</xsl:template>




I looked at it again and I saw this strange construct in the apply-templates above, which is likely your problem.

This cannot possibly compile. It is a compile time error to have an axis specification (self::) followed by anything other than a node or node name. I'm still wondering what you meant with "nothing", as you must have had an error at the very least. If you use a running environment where you don't see any errors, I highly recommend you to choose one that does (the commandline itself can be very helpful).

The original code looked as follows. Leave it as that and you should be fine (there was nothing to replace there, because there was no key):

<xsl:apply-templates select="*[not(self::sample_date_time)]" />

Cheers,
-- Abel Braaksma


_________________________________________________________________
Share folders without harming wildlife! http://www.communicationevolved.com/en-za/


Current Thread

PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.