[XSL-LIST Mailing List Archive Home] [By Thread] [By Date]

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: "kieters c" <kieters@xxxxxxxxxxx>
Date: Tue, 22 May 2007 19:30:05 +0000

Hi Abel,

Thank you for your input. Sorry I could not get back to you earlier.

I have been looking at several versions of Muenchian Grouping and are reading up on what I can find. Have printed several bits of information from the Internet and are trying to get to grips with the terminology. I am also trying several things I do see and if it does not work I start again. Your output gives me the frame work to build on and I am learning from it.

I will get it it working as I do have some time to play with it before I need to submit a report.

I thank you for your patience and encouragement and the time you were willing to spend in dealing with my problem.

Thanks.

Hennie


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


_________________________________________________________________
Make free PC-to-PC calls with no loss of life! http://www.communicationevolved.com/en-za/



Current Thread
Keywords