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

removing duplicates problem

Subject: removing duplicates problem
From: Jeremy Quinn <jeremy@xxxxxxxxxxxxxxxxx>
Date: Tue, 28 Dec 1999 20:29:53 +0000
remove duplicates problem
I am in the situation of wanting to create a node-set of all the 
    <person idref="Smith"/> and <author idref="Jones"/> tags with unique idref attributes. The tags can be found almost anywhere in the document.

I am making a list of <person> and <author> elements using:


<xsl:template name="people">
    <xsl:variable 
        name="all" 
        select=".//person[@idref]|.//author[@idref]" 
        />

then trying to remove duplicates by selecting into a new variable like this:

    <xsl:variable 
        name="unique" 
        select="$all[not(.=following::$all)]" 
        />

before looking them up from another document and passing them to a "person" template:

    <xsl:for-each select="$unique">
        <xsl:variable name="pid" select="(@idref)"/>
        <xsl:for-each select="document('../xml/data/people.xml')">
            <xsl:apply-templates select="id($pid)"/>
        </xsl:for-each>
    </xsl:for-each>
</xsl:template>


The line trying to remove the duplicates does not compile, I guess I'm trying this the wrong way ;-)

Any suggestions welcome.
I am using Saxon 5.1 btw, though I doubt the problem stems from there ;-)

regards Jeremy

   ___________________________________________________________________

   Jeremy Quinn                                           Karma Divers
                                                       webSpace Design
                                            HyperMedia Research Centre

   <mailto:jeremy@xxxxxxxxxxxxxxxxx>     <http://www.media.demon.co.uk>
    <phone:+44.[0].207.737.6831>        <pager:jermq@xxxxxxxxxxxxxxx>



 XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list


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.