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

[xsl] Keys with duplicates should be simple


Subject: [xsl] Keys with duplicates should be simple
From: Ihe Onwuka <ihe.onwuka@xxxxxxxxx>
Date: Fri, 31 Jan 2014 00:19:05 +0000

Wanting all <a> elements that have more than one hyperlink to the same person.

  <xsl:import href="identity.xsl"/>
  <xsl:key name="person" match="a" use="@href"/>

  <xsl:template match="person">
    <duplicate>
      <xsl:apply-templates select="a[key('person',@href)[2]]"/>
    </duplicate>
  </xsl:template>

Problem. I get all the duplicates (I think) but I also get things that
are not duplicates for example from this subset the first person I
should get is allison-benedikt but I get her and (before her)
abhimanyu-das. This phenomenon repeats later in the dataset.

<person >
   <a href="/person/aa-dowd/"/>
   <a href="/person/ao-scott/"/>
   <a href="/person/aaron-hillis/"/>
   <a href="/person/abhimanyu-das/"/>
   <a href="/person/adam-markovitz/"/>
   <a href="/person/adam-smith/"/>
   <a href="/person/addison-macdonald/"/>
   <a href="/person/aisha-harris/"/>
   <a href="/person/akiva-gottlieb/"/>
   <a href="/person/alan-morrison/"/>
   <a href="/person/alan-scherstuhl/"/>
   <a href="/person/alison-willmore/"/>
   <a href="/person/allison-benedikt/"/>
   <a href="/person/allison-benedikt/"/>
</person>


Current Thread