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

RE: sort; no duplicates

Subject: RE: sort; no duplicates
From: "Michael Kay" <michael.h.kay@xxxxxxxxxxxx>
Date: Tue, 25 Jun 2002 12:08:39 +0100
xsl sort duplicates
Your <city> elements are not siblings of each other, and they are
definitely not siblings of a contents element. Change

<xsl:for-each 
> select="contents/entry/city[not(.=preceding-sibling::contents/
> entry/city)]">

to

<xsl:for-each 
> select="contents/entry[not(city=preceding-sibling::entry/city)]">

Your code is going from a city element to a preceding-sibling::contents,
which is obviously wrong.

Michael Kay
Software AG
home: Michael.H.Kay@xxxxxxxxxxxx
work: Michael.Kay@xxxxxxxxxxxxxx 

> -----Original Message-----
> From: owner-xsl-list@xxxxxxxxxxxxxxxxxxxxxx 
> [mailto:owner-xsl-list@xxxxxxxxxxxxxxxxxxxxxx] On Behalf Of William S.
> Sent: 25 June 2002 11:02
> To: xsl-list
> Subject:  sort; no duplicates
> 
> 
> I have looked at the FAQ(s) and not been able to get the 
> sort/no duplicate thing to work. Below is an example of an 
> XML and XSL file. All I want to do is print out the data so I 
> have a list of cities with no duplicates. With the example 
> XML below that would be:
> 
> 	'boston new york'
> 
> Can someone revise my stylesheet so it will work.
> I am using php with Sablotron.
> 
> *** sort.xml
>  
> <?xml version="1.0" ?>
> <contents>
> <entry>
> <city>boston</city><record>one</record>
> </entry>
>  
> <entry>
> <city>boston</city><record>two</record>
> </entry>
>  
> <entry>
> <city>new york</city><record>one</record>
> </entry>
> </contents>
> 
> *** sort.xsl
>  
> <xsl:template match="/"> <!-- At top of page -->
>  
> <xsl:for-each 
> select="contents/entry/city[not(.=preceding-sibling::contents/
> entry/city)]">
>         <xsl:sort/>
>         <xsl:value-of select="."/>
> </xsl:for-each>
>  
> </xsl:template> <!-- At bottom of page -->
> -- 
> Bill
> Amsterdam, NL
> 
>  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.