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

Re: [xsl] Combining xsl:keys

Subject: Re: [xsl] Combining xsl:keys
From: "Joris Gillis" <roac@xxxxxxxxxx>
Date: Sat, 22 Jan 2005 10:29:16 +0100

Tempore 22:28:52, die 01/21/2005 AD, hinc in xsl-list@xxxxxxxxxxxxxxxxxxxxxx scripsit David Laurie <dlaurie@xxxxxxxxxxx>:

Hello all,

I read a post in the FAQ regarding getting a key to perform two different
functions by assigning the same key name two different uses

I have tried to make this work for the following problem without success: I
have a template creating and alphabetic list of titles following the
Meunschian sorting method (and some coding advice form this list -- Thx!!). I
now want to remove any duplicates from this list. My attempts involving t a
second key function produce a null set. (I have also tried the more
straightforward selection of title(not[.=preceding::title]) without success.

I don't see any duplicates in your xml, maybe its just a small part of the real xml? Or do you consider the 'Climate in Alberta' series as duplicates?
I'll assume you mean with duplicates "maptitles that are stringwise indentical".

With tke keys:
<xsl:key name="maps" match="part/chapters/mapunits/maps/maptitle" use="substring(., 1, 1)"/>
<xsl:key name="maps" match="part/chapters/mapunits/maps/maptitle" use="."/>

<xsl:for-each select="key('maps', $firstletter)[generate-id(.) = generate-id(key('maps', .)[1])]">
<div class="mapTitle">
<xsl:value-of select="."/>

using the 'preceding' axis:

<xsl:value-of select="self::maptitle[not(.=preceding::maptitle)]"/>

regards, -- Joris Gillis (http://www.ticalc.org/cgi-bin/acct-view.cgi?userid=38041) Veni, vidi, wiki (http://www.wikipedia.org)

Current Thread