|
[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] Re: Eliminating Duplicate Elements
Antony,
<xsl:copy-of select="//fred[not(wilma/pebbles/text() = preceding::wilma/pebbles/text())]"/> would do the job. if you have a structure like the one you have given.. ( i have added <students> as root element..) <?xml version="1.0"?> <students> <fred> <wilma> <pebbles> one </pebbles> </wilma> </fred> <fred> <wilma> <pebbles> two </pebbles> </wilma> </fred> <fred> <wilma> <pebbles> one </pebbles> </wilma> </fred> </students> and if you want to eliminate the duplicates and print one,two ( the texts in pebbles) instead of one,two, one then the simplest way of doing this is.. <xsl:template match="/"> <xsl:for-each select="//pebbles[not(. = preceding::pebbles/text())]"> <xsl:value-of select="."/> <xsl:if test="not(position()=last())"> <xsl:text>,</xsl:text> </xsl:if> </xsl:for-each> this would give one , two refer the XSLT-Reference to know how to use the axis ( when to use preceding , preceding-sibling , following etc..) Vasu From: Antony.Tomasovic@xxxxxxxx Reply-To: xsl-list@xxxxxxxxxxxxxxxxxxxxxx To: XSL-List@xxxxxxxxxxxxxxxxxxxxxx Subject: Eliminating Duplicate Elements Date: Wed, 14 Aug 2002 14:33:13 +1000 _________________________________________________________________ MSN Photos is the easiest way to share and print your photos: http://photos.msn.com/support/worldwide.aspx 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








