xsl-list
[Top] [All Lists]

Re: [xsl] How do I change a XSL style sheet to group data together under one heading

2007-05-22 08:30:33
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


--~------------------------------------------------------------------
XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: <mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--

<Prev in Thread] Current Thread [Next in Thread>