Re: [xsl] What is wrong with this key element?

Subject: Re: [xsl] What is wrong with this key element?
From: Jeni Tennison <mail@xxxxxxxxxxxxxxxx>
Date: Thu, 6 Sep 2001 11:43:39 +0100
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


Current Thread