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

Re: showing unique element values only

Subject: Re: showing unique element values only
From: Jeni Tennison <mail@xxxxxxxxxxxxxxxx>
Date: Thu, 1 Feb 2001 14:25:13 +0000
unique element xsl
Hi Keith,

> I've tried manipulating the order of the ACHFee element with
> <xsl:sort select="feeLevelBottom"/> and so-on. I've used every
> combination of preceding::, following::, following-sibling:: that I
> can come up with, but I still cannot make ONLY UNIQUE cell contents
> be displayed

Here's what you're missing: axes *always* operate on the structure of
the original XML, it don't matter how much you sort or what axes you
try.

At the moment you trying to do (roughly)

  for each ACHfee
    sorted according to feeLevelBottom
       if you haven't already processed something with the same
             feeLevelBottom
          then process this one

Instead, you need to turn it around so that you only select the first
ACHfees with a particular feeLevelBottom in the first place, iterate
over them, and sort *them* according to the feeLevelBottom.

For example:

<xsl:for-each select="//ACHFee
                       [not(feeLevelBottom =
                            preceding::ACHFee/feeLevelBottom)]">
   <xsl:sort select="feeLevelBottom" />
   ...
</xsl:for-each>
                       
You may find it more efficient to use the Muenchian Method to get the
list of fees with unique feeLevelBottoms.  Define a key:

<xsl:key name="fees"
         match="ACHFee"
         use="number(feeLevelBottom)" />

And then select the ACHFees with unique feeLevelBottom values with:

<xsl:for-each
   select="//ACHFee
             [count(.|key('fees', number(feeLevelBottom))[1]) = 1]">
   <xsl:sort select="feeLevelBottom" />
   ...
</xsl:for-each>

I hope that helps,

Jeni

---
Jeni Tennison
http://www.jenitennison.com/



 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.