|
[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] removing 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
|
PURCHASE STYLUS STUDIO ONLINE TODAY!Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced! Download The World's Best XML IDE!Accelerate XML development with our award-winning XML IDE - Download a free trial today! Subscribe in XML format
|

Cart








