Subject: Re: [xsl] How do I change a XSL style sheet to group data together under one heading From: "kieters c" <kieters@xxxxxxxxxxx> Date: Tue, 22 May 2007 19:30:05 +0000 |
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: Tue, 22 May 2007 17:27:54 +0200
Hi Hennie,
I highly recommend you to read any first chapter of any textbook or tutorial book on XSLT. Even the very basic introduction on www.w3schools.com will (may?) give you the information you need to craft your own XPath expression to the level needed for your needs in this stylesheet.
To give you a head start:
1. Combining node sets is done with the union operator |, not with the comma operator (which is introduced in XSLT 2.0, not 1.0)
2. It is not possible to do a node test on a string. Thus, self::concat(x,y) is not legal, because concat returns a string.
3. The function not() can have only one argument. If you want to combine several not-tests, you'll have to use multiple not() functions: not(a) or not(b) etc, instead of not(a,b). Of course you can also combine node tests inside the not() using the union operator.
Spending one or two days with learning XPath and XSLT will save you a lot of problems and time. To learn about how keys work and how they can help you with grouping, is (quite) a bit harder: search for Muenchian Grouping on the net. To be able to mold this code the way you want it, and to maintain it, learning XSLT or hiring someone that already knows XSLT are your best options.
Cheers, -- Abel Braaksma
kieters c wrote:I have tried the following and the error mesage for each.
<!-- date-time must become an attribute -->
<xsl:apply-templates select="sample_date_time, cp_name, imis_cp_ext, dischg_sample_cd, sample_comment" /> ####
<xsl:apply-templates select="key('sample', concat(sample_date_time, cp_name, imis_cp_ext, dischg_sample_cd, sample_comment))" />
and
<xsl:apply-templates select="*[not(self::sample_date_time, cp_name, imis_cp_ext, dischg_sample_cd, sample_comment)]" />
Line 16, character 38 (I assume it is line ###) Stylesheet error: Invalid XPath Expression Select
<!-- date-time must become an attribute -->
<xsl:apply-templates select="sample_date_time" />
<xsl:apply-templates select="key('sample', concat(sample_date_time, cp_name, imis_cp_ext, dischg_sample_cd, sample_comment))" />
And
<xsl:apply-templates select="*[not(self::sample_date_time, cp_name, imis_cp_ext, dischg_sample_cd, sample_comment)]
error:
Line 24 character 34 Error in XPath Expression, Error in XPath Expression,
Finally I tried the same as above but
<xsl:apply-templates select="*[not(self::concat(sample_date_time, cp_name, imis_cp_ext, dischg_sample_cd, sample_comment))]" />
Error Line 24 character 34 Stylesheet error: Invalid XPath Expression Select
I unfortunately do not have any say in the format of the final result as it is laid down by some other authority.
Thanks.
Hennie
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
Re: [xsl] How do I change a XSL sty, Abel Braaksma | Thread | RE: [xsl] How do I change a XSL sty, Michael Kay |
[xsl] fo:table-cell aligment, Luke | Date | [xsl] Using the key function, Fanghanel, Karl |
Month |