This is the mail archive of the xsl-list@mulberrytech.com mailing list .


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Re: What is wrong with this key element?


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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]