Re: [xsl] sort; no duplicates

Subject: Re: [xsl] sort; no duplicates
From: "Vasu Chakkera" <vasucv@xxxxxxxxxxx>
Date: Tue, 25 Jun 2002 10:35:29 +0000
William

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

...this will search for the preceding sibling named 'contents' for the node 'city'..and that doesnt exist ( content is not a sibling for city)


you may want to use
<xsl:for-each
select="/contents/entry/city[not(.=preceding::city)]">

HTH
Vasu



From: "William S." <wstan@xxxxxxxxx>
Reply-To: xsl-list@xxxxxxxxxxxxxxxxxxxxxx
To: xsl-list <XSL-List@xxxxxxxxxxxxxxxxxxxxxx>
Subject: [xsl] sort; no duplicates
Date: Tue, 25 Jun 2002 12:01:53 +0200

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




_________________________________________________________________
Get your FREE download of MSN Explorer at http://explorer.msn.com/intl.asp.


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



Current Thread