|
Subject: removing duplicates problem From: Jeremy Quinn <jeremy@xxxxxxxxxxxxxxxxx> Date: Tue, 28 Dec 1999 20:29:53 +0000 |
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 |
|---|
|
| <- Previous | Index | Next -> |
|---|---|---|
| Re: formatting numbers and dates, David_Marston | Thread | New XSL Stylesheets and things, or., Norman Walsh |
| Re: formatting numbers and dates, David_Marston | Date | Re: Running totals, Jon Smirl |
| Month |