Subject: Re: Muenchian keys ... plus a bit?
From: Jeni Tennison <mail@xxxxxxxxxxxxxxxx>
Date: Wed, 22 Aug 2001 10:45:54 +0100
|
Hi Dave,
> Question, how to remove the duplicate entries without losing
> the page numbers associated with the duplicate?
I assume that you have a key that indexes the ent elements by the
first letter of their item child:
<xsl:key name="entries-by-letter" match="ent" use="item" />
and that you use this to get all the entries that start with a
particular letter:
key('entries-by-letter', $letter)
If you also create a key that indexes the ent elements by the value of
the item:
<xsl:key name="entries" match="ent" use="item" />
then you can find a list of the unique terms for a particular letter
by searching through the set of entries returned by the
entries-by-letter key and pulling the Muenchian trick on them:
key('entries-by-letter', $letter)
[count(.|key('entries', item)[1]) = 1]
So you create one entry in your index for each of the terms. When it
comes to finding the list of page numbers, you need to use the entries
key again:
key('entries', $term)/pge
I hope that's enough to get you to a solution,
Jeni
---
Jeni Tennison
http://www.jenitennison.com/
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
|