This is the mail archive of the
xsl-list@mulberrytech.com
mailing list .
Re: Muenchian Method
- To: Doug dot Hewko at ccra-adrc dot gc dot ca
- Subject: Re: [xsl] Muenchian Method
- From: Jeni Tennison <mail at jenitennison dot com>
- Date: Fri, 3 Aug 2001 15:16:37 +0100
- CC: xsl-list <xsl-list at lists dot mulberrytech dot com>
- Organization: Jeni Tennison Consulting Ltd
- References: <a05100304b78f53afd671@[192.168.254.19]>
- Reply-To: xsl-list at lists dot mulberrytech dot com
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