Re: [xsl] Grouping problem

Subject: Re: [xsl] Grouping problem
From: David Carlisle <davidc@xxxxxxxxx>
Date: Thu, 12 Jun 2003 12:04:37 +0100

> The problem I'm having is I'm trying to use Meunchian grouping and while I
> can get the first grouping using

The trick to doing subgrouping using keys is to note that xslt doesn't
have compound key values so you have to fake it using string
concatenation.

For your outer group you group on Division so have

<xsl:key name="resources-div" match="resource" use="Division" />


for your inner group you want to group things which have the same
author so

<xsl:key name="resources-div-auth" match="resource" use="concat(Division,':',author)" />

and use a similar concat in the key()

actually since your input looks like

			<Division>
				A
			</Division>

and you probably want that to be in the same group as


			<Division>
    A
			</Division>


you would be better to have

<xsl:key name="resources-div" match="resource" use="normalize-space(Division)" />
and similarly normalize-space(Division) an normalize-space(Author) in
the second key, and in calls to this key with the key() function.

Note you'll often find people on this list supply working code as well
as (or instead of) explanantaions, but to get that it helps to be given a well
formed input document, your sample input was very long, but not well formed.
for example

			<Div Head>
				Person C	
			</Div Head>

isn't XML.


As always with grouping things have a look at Jeni's site.

David

________________________________________________________________________
This e-mail has been scanned for all viruses by Star Internet. The
service is powered by MessageLabs. For more information on a proactive
anti-virus service working around the clock, around the globe, visit:
http://www.star.net.uk
________________________________________________________________________

 XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list


Current Thread