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

Re: Remove duplicates from a list

Subject: Re: Remove duplicates from a list
From: Minita Jha <jha@xxxxxxxxxxx>
Date: Thu, 28 Oct 1999 10:16:43 -0400 (EDT)
remove duplicates from a list
Hi Clark,
  Thanks for your help. But unfortunately it still does not work for me. I am 
using xslp as my xsl processor. I have attached the xml and xsl code. Could you 
take a look at it when you have a few moments to spare, please? Thanks a lot. I 
hope I'm not bothering you.
  
Minita.

> Date: Wed, 27 Oct 1999 18:24:00 -0400 (EDT)
> From: "Clark C. Evans" <clark.evans@xxxxxxxxxxxxxxxxxxxx>
> X-Sender: clark@xxxxxxxxxxxxxxxxxxxxx
> To: xsl-list@xxxxxxxxxxxxxxxx
> Subject: Re: Remove duplicates from a list
> MIME-Version: 1.0
> 
> 
>   <xsl:variable name="unique-list"
>     select="//state[not(.=following::state)]" />   
> 
>   <xsl:for-each select="$unique-list">
> 	<xsl:value-of select="." />
>   </xsl:for-each>
> 
> On Wed, 27 Oct 1999, Minita Jha wrote:
> >  <location>
> >    <state>xxxx</state>
> >  </location>
> >   
> >  <location>
> >     <state>yyyy</state>
> >  </location>
> >  
> >   <location>
> >     <state>xxxx</state>
> >  </location>
> >  
> >  The desired output is:
> >  
> >    xxxx
> >    yyyy
> >    
> >  That is, duplicate values of state should not be printed.
> >  Can this be done? 
> 
> 
>  XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
Title: Study

Sorted locations with unique state headers

<location>    
<state >Virginia</state> 
</location> 


<location>    
<state> Virginia</state> 
</location> 

<location>
<state >Maryland</state>
</location>

<location>    
<state>Maryland</state> 
</location> 


<!-- This is a test to group locations by facility state. -->
<?xml version="1.0"?>

<xsl:stylesheet xmlns:xsl="http://www.w3.org/XSL/Transform/1.0"
                xmlns="http://www.w3.org/TR/REC-html40" 
                result-ns="">
 
   <xsl:template match="/">
      <html>
         <head>
            <title>
               Study 
            </title>
         </head>

         <BODY bgcolor="#ffffff">
            <P>Sorted locations with unique state headers</P>

            <xsl:variable name="unique-list"
               select="//state[.] = following::state" />   

             <xsl:for-each select="$unique-list">
	           <xsl:value-of select="." />
             </xsl:for-each>


         </BODY>
      </html>
   </xsl:template>

</xsl:stylesheet>
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.