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

select-distinct in for-each ?

Subject: select-distinct in for-each ?
From: "Clark C. Evans" <clark.evans@xxxxxxxxxxxxxxxxxxxx>
Date: Sun, 3 Oct 1999 02:44:29 -0400 (EDT)
select distinct in
Hello.  I have a hierarchy 3 layers deep, and I'm
trying to build a cross-reference of a repeating
group in the lowest layer.  To do this, I have
a <xsl:for-each ... /> with a <xsl:sort ... /> .
As you guess, I have duplicates that need to
be removed -- I'm looking for a select-distinct.
  
I found this in the FAQ but it partially works:
       
    Q: 2.46   
    
    How to remove duplicate nodes from a
    node-set according to content?
    
    A: 2.46 - David Carlisle
     
    select="reference[not(@name=following::reference/@name)]"
    will return you a list of reference elements with no
    two having the same name.
       
Here is my sample data:
  
 <a>
    <b>
      <c>X</c>
    </b>
    <b>
      <c>X</c>
    </b>
    <b>
      <x>Z</x>
    </b>
</a>
<a>
    <b>
      <c>X</c>
    </b>
</a>
       

What I want is:
       
X
Z

What I tried (among many many other things...)
    
<xsl:for-each select="//c[not(text()=following::c/text())]" >
  <xsl:sort order="ascending" select="." />
  <xsl:value-of select="." /><br/>
</xsl:for-each>
       
      
What I get using August 22 version of XT
       
X
X
Z
     
...

It seems that following:: is grabbing the
next sibling, however, if you go up one
node and then go back down it does not
seem to pick this up.

Am I missing anything?

Thanks!
       
Clark
 



 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.