[XSL-LIST Mailing List Archive Home] [By Thread] [By Date]

[xsl] keys with Muenchian Method of grouping help


Subject: [xsl] keys with Muenchian Method of grouping help
From: Jinesh Varia <jineshresearch@xxxxxxxxx>
Date: Wed, 19 Feb 2003 08:43:28 -0800 (PST)

hello,
I read Jeni tennison's XML Muenchian Method grouping using keys.

I have a document which is something like this:
<publication pubid="0002">
<author>afdasdf</author
<author>53454asdf</author>
<editor>fhjfhj </editor>
</publication>
<publication pubid="00022">
<author>afdasdf</author>
<editor>fhjfhj </editor>
</publication>
<publication pubid="00023">
<editor>fhjfhj </editor>
</publication>

I want to list all the authors and editors seperately as 
<person><personname>asdfasdf</personname></person> 
outside the publication element.

//publication/author[not(.=preceding-sibling::publication/author or
.=preceding-sibling::publication/editor)]|//publication/editor[not(.=preceding-sibling::publication/author
or .=preceding-sibling::publication/editor)]

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" />
<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)))]" />

Can anybody help me in devising this XPATH query please

thanks
Jinesh






=====
-----------------------------------------------------------------
Jinesh Varia
Graduate Student, Information Systems
Pennsylvania State University
Email: jinesh@xxxxxxx
-----------------------------------------------------------------
'Self is the author of its actions.'

__________________________________________________
Do you Yahoo!?
Yahoo! Shopping - Send Flowers for Valentine's Day
http://shopping.yahoo.com

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



Current Thread
Keywords