[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

Re: keys with Muenchian Method of grouping help

Subject: Re: keys with Muenchian Method of grouping help
From: Jeni Tennison <jeni@xxxxxxxxxxxxxxxx>
Date: Wed, 19 Feb 2003 17:08:45 +0000
muenchian method generate id
Hi Jinesh,

> But this stupidly inefficient and bad style especially because I
> have around more than 500,000 author and editor nodes. and preceding
> siblings axis is taking like hours.... An expert suggested me to use
> keys. I was trying to code them:
>
> <xsl:key name="person" match="//publication/author or //publication/editor" use="author|editor" />

The match attribute needs to take a pattern (like the match attribute
of <xsl:template>) rather than an expression. Also, the use attribute
should give you a unique value for each node that's matched by the
match attribute. Since <author> and <editor> elements don't themselves
have <author> or <editor> children, your key above wouldn't find any
value for the <author> and <editor> elements that you're matching.

Try:

<xsl:key name="person"
         match="publication/author | publication/editor"
         use="." />

> <xsl:apply-templates select="*[(author and
> generate-id(.)=generate-id(key('person', author|editor)) or (editor
> and generate-id(.)=generate-id(key('person', author|editor)))]" />

For this, you need to select <author> and <editor> elements that have
unique values. Again, remember that the <author> and <editor> elements
don't have <author> or <editor> children. Try:

<xsl:apply-templates
  select="(//publication/author | //publication/editor)
            [generate-id(.) = generate-id(key('person', .)[1])]" />

Cheers,

Jeni

---
Jeni Tennison
http://www.jenitennison.com/


 XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list


Current Thread

PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.