This is the mail archive of the
xsl-list@mulberrytech.com
mailing list .
Re: What is wrong with this key element?
- To: "Yang" <sfyang at unisvr dot net dot tw>
- Subject: Re: [xsl] What is wrong with this key element?
- From: Jeni Tennison <mail at jenitennison dot com>
- Date: Thu, 6 Sep 2001 11:43:39 +0100
- CC: xsl-list at lists dot mulberrytech dot com
- Organization: Jeni Tennison Consulting Ltd
- References: <000b01c136b8$c47d6880$1601800a@hqlab.unisvr>
- Reply-To: xsl-list at lists dot mulberrytech dot com
Hi Sun-fu,
> <xsl:key name="prodCat" match="@ProdCode" use="substring(@ProdCode,1,3)"/>
You're matching @ProdCode attributes and indexing them by their
@ProdCode attribute; attributes don't have attributes, you meant:
<xsl:key name="prodCat" match="z" use="substring(@ProdCode, 1, 3)" />
or possibly:
<xsl:key name="prodCat" match="@ProdCode" use="substring(., 1, 3)" />
and then:
<xsl:variable name="uniCat"
select="/doc/z[generate-id() =
generate-id(key('prodCat',
substring(@ProdCode,1,3))[1])]" />
or:
<xsl:variable name="uniCat"
select="/doc/z/@ProdCode[generate-id() =
generate-id(key('prodCat',
substring(.,1,3))[1])]" />
Cheers,
Jeni
---
Jeni Tennison
http://www.jenitennison.com/
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list