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

Re: [xsl] Keys with duplicates should be simple


Subject: Re: [xsl] Keys with duplicates should be simple
From: Graydon <graydon@xxxxxxxxx>
Date: Thu, 30 Jan 2014 19:45:49 -0500

On Thu, Jan 30, 2014 at 04:38:49PM -0800, Dimitre Novatchev scripsit:
> <xsl:key name="person" match="a" use="@href"/>
>    <xsl:template match="person">
>      <duplicate>
>        <xsl:copy-of select="a[key('person',@href)[2]]"/>
>      </duplicate>
>    </xsl:template>
> </xsl:stylesheet>

Can I note that the [2] would appear to suppose that there's only ever
one duplicate?

not(position() eq 1) is likely safer.

-- Graydon


Current Thread