[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

Re: Keys with duplicates should be simple

Subject: Re: Keys with duplicates should be simple
From: "Imsieke, Gerrit, le-tex" <gerrit.imsieke@xxxxxxxxx>
Date: Fri, 31 Jan 2014 01:46:06 +0100
Re:  Keys with duplicates should be simple
When I run this (with my own implementation of identity.xsl, with Saxon-EE 9.5.1.3 invoked from the oXygen 15.2 debugger), I get:

<duplicate>
  <a href="/person/allison-benedikt/"/>
  <a href="/person/allison-benedikt/"/>
</duplicate>

So there are no other records than the duplicates.

In order to just have a single line per duplicate group, I donbt see a straightforward solution that uses the key.

And if you're using for-each-group anyway, you can do without the keys:

<xsl:for-each-group select="a" group-by="@href">
  <xsl:if test="count(current-group()) gt 1">
    <xsl:apply-templates select="."/>
  </xsl:if>
</xsl:for-each-group>

Gerrit

On 31.01.2014 01:19, Ihe Onwuka wrote:
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>


-- Gerrit Imsieke GeschC$ftsfC<hrer / Managing Director le-tex publishing services GmbH Weissenfelser Str. 84, 04229 Leipzig, Germany Phone +49 341 355356 110, Fax +49 341 355356 510 gerrit.imsieke@xxxxxxxxx, http://www.le-tex.de

Registergericht / Commercial Register: Amtsgericht Leipzig
Registernummer / Registration Number: HRB 24930

GeschC$ftsfC<hrer: Gerrit Imsieke, Svea Jelonek,
Thomas Schmidt, Dr. Reinhard VC6ckler

Current Thread

PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.