This is the mail archive of the
xsl-list@mulberrytech.com
mailing list .
Re: Muenchian keys ... plus a bit?
- To: DPawson at rnib dot org dot uk
- Subject: Re: [xsl] Muenchian keys ... plus a bit?
- From: Jeni Tennison <mail at jenitennison dot com>
- Date: Wed, 22 Aug 2001 10:45:54 +0100
- CC: xsl-list at lists dot mulberrytech dot com
- Organization: Jeni Tennison Consulting Ltd
- References: <9B66BBD37D5DD411B8CE00508B69700FE7A3AA@pborolocal.rnib.org.uk>
- Reply-To: xsl-list at lists dot mulberrytech dot com
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