Subject: Re: [xsl] keys with Muenchian Method of grouping help From: Jeni Tennison <jeni@xxxxxxxxxxxxxxxx> Date: Wed, 19 Feb 2003 17:08:45 +0000 |
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 |
---|
|
<- Previous | Index | Next -> |
---|---|---|
[xsl] keys with Muenchian Method of, Jinesh Varia | Thread | [xsl] Saxon is the best!!!, Jinesh Varia |
Re: [xsl] The Perils of Sudden Type, Jeni Tennison | Date | RE: [xsl] Selecting from a node-set, Américo Albuquerque |
Month |