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

RE: Unique question

Subject: RE: Unique question
From: Darren Hayduk <dhayduk@xxxxxxxxxxxxxxx>
Date: Fri, 5 Oct 2001 14:15:34 -0400
unique question
Thanks to Joerg and Dimitre for your thoughts on my count unique question.

After posting my question, I started playing with Saxon and temporary
node-sets to solve the problem, and it seems much easier with v1.1:
    <xsl:for-each select="/groups/group">
      <xsl:variable name="indexes">
        <xsl:for-each select="*/*[@index!='']">
          <xsl:copy>
            <xsl:value-of select="@index"/>
          </xsl:copy>
        </xsl:for-each>
      </xsl:variable>
      <xsl:if test="count(*/*[@index!='']) !=
count($indexes/*[not(.=preceding::*)])">
        <!-- ERROR -->
      </xsl:if>
    </xsl:for-each>

-----Original Message-----
Now, when I'm completely awake, I see that the problem was to count the
unique
"index" attributes ***within a group***.

<xsl:key name="kIndex" match="@index" 
         use="concat(generate-id(../../..), '~',.)"/>

Then if $x contains the position of the "group", for which we need to know
the count
of unique "index" attributes, the following XPath expression returns this
count:

count(
/groups/group[$x]/*/*/@index[generate-id() 
                            = 
                            generate-id(key('kIndex', 
 
concat(generate-id(/groups/group[$x]),
                                                   '~',
                                                   .)
                                           )[1]
                                       )
                            ]
     )


 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.