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

RE: Avoiding duplicates in the node selection

Subject: RE: Avoiding duplicates in the node selection
From: Linda van den Brink <lvdbrink@xxxxxxx>
Date: Wed, 28 Jun 2000 16:32:22 +0200
avoiding duplicates in select
You have a sorting & grouping problem, I advise you to look in the FAQ under
sorting/grouping. 

Linda

> -----Original Message-----
> From: Max Rubinstein [mailto:mrubinst@xxxxxxxxxxx]
> Sent: Wednesday, June 28, 2000 3:49 PM
> To: XSL-List@xxxxxxxxxxxxxxxx
> Cc: mrubinst@xxxxxxxxxxx
> Subject: Avoiding duplicates in the node selection
> 
> 
> Hi,
> 
> I have the following XML source:
> 
> <Resources>
> 	<Resource URL="http://www.aspindustry.org/">
> 		<Keywords> <ASP/> <SB/> </Keywords>
> 	</Resource>
> 	<Resource URL="http://www.aspnews.com/">
> 		<Keywords> <ASP/> </Keywords>
> 	</Resource>
> 	<Resource URL="http://msdn.microsoft.com/wmi.asp">
> 		<Keywords> <WMI/> </Keywords>
> 	</Resource>
> </Resources>
> 
> As you may notice, the same keyword may appear under 
> different resources. My 
> goal is to produce a list of keywords, sorted alphabetically, with no 
> duplicates, to populate the HTML list with options.
> 
> This is the XSL I came up with:
> 
> <?xml version="1.0" ?>
> <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" 
> version="1.0">
>   	<xsl:template match="/">
>   		<xsl:for-each select="//Keywords/node()">
> 			<xsl:sort select="name()" order="ascending"/>
> 			<option>
> 				<xsl:attribute 
> name="value"><xsl:value-of 
> select="name()"/></xsl:attribute>
> 				<xsl:value-of select="name()"/>
> 			</option>
>   		</xsl:for-each>
>   	</xsl:template>
> </xsl:stylesheet>
> 
> It works, but I get duplicate entries as a result.  I would 
> like to figure 
> out how to remove duplicate keywords.
> 
> Thanks for any help,
> 
> -Max
> 
> 
> ______________________________________________________________
> __________
> Get Your Private, Free E-mail from MSN Hotmail at 
http://www.hotmail.com


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


 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.