Subject: Re: Muenchian Method
From: Jeni Tennison <mail@xxxxxxxxxxxxxxxx>
Date: Fri, 3 Aug 2001 15:16:37 +0100
|
Hi Doug,
> I would like to group an XML file so the HTML would be like this:
Your XSLT is almost there. The only problem is that the path you're
using in the use attribute of xsl:key (and later, when you try to get
unique nodes) isn't correct. Your key is:
<xsl:key name="contacts-by-surname" match="member" use="last_name" />
But you the last_name element isn't a direct child of the member
element - you should be stepping down through the name element, i.e.:
<xsl:key name="contacts-by-surname" match="member"
use="name/last_name" />
^^^^^
Similarly, when you select the unique members, you need to use a path
that takes you from the member element to the last_name element, i.e.:
member[count(.|key('contacts-by-surname', name/last_name)[1]) = 1]
^^^^^
In the final use of the key, you got the path right, but added quotes
around it, so it's trying to find members with the surname
"name/last_name", which I doubt anyone has. There, again, you need:
key('contacts-by-surname', name/last_name)
I hope that helps,
Jeni
---
Jeni Tennison
http://www.jenitennison.com/
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
|