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

Re: Stuck on how to properly use 'preceding' axis

Subject: Re: Stuck on how to properly use 'preceding' axis
From: Rusty Morton <rusty_morton@xxxxxxxxx>
Date: Wed, 12 Jul 2006 17:11:46 -0700 (PDT)
Re:  Stuck on how to properly use 'preceding' axis
Thanks for the help Jason!

You are absolutely right on the EME value - it should
not be shown as well. 

I tweaked your solution just a little since i have to
store the value in a variable - and got it to work
using the following:

<xsl:variable name="distributorVal">	
<!-- only process distributorCodes if canShip and
canOrder are both true -->
  <xsl:for-each
select="//ItemAsMade/ItemsAsSold/ItemAsSold[CanOrderFlag
='true'][CanShipFlag = 'true'][not(DistributorCode =
preceding::DistributorCode)]/DistributorCode">
     <xsl:value-of select="."/>
     <xsl:text>,</xsl:text>
  </xsl:for-each>
</xsl:variable>


Though the above worked - and did in fact remove
duplicates, it also removed some unique values as
well.
The logic above seems to be also removing values if
the CanOrderFlag ='false'OR CanShipFlag = 'false' in
any nodes following the first. When I need it to
return any distinct values within any of the
<ItemsAsMade> nodes where it satisfies the
CanOrder/Ship condition.
For example, seethe sample XML below.....

- <ItemsAsMade>
- <ItemAsMade>
  <ManufacturerCode>SHO</ManufacturerCode> 
  <SupplierCode>SHO</SupplierCode> 
  <Currency>USD</Currency> 
  - <ItemsAsSold>
    - <ItemAsSold>
        <DistributorCode>UKI</DistributorCode> 
        <CanOrderFlag>true</CanOrderFlag> 
        <CanShipFlag>true</CanShipFlag> 
      </ItemAsSold>
    - <ItemAsSold>
        <DistributorCode>MEX</DistributorCode> 
        <CanOrderFlag>true</CanOrderFlag> 
        <CanShipFlag>true</CanShipFlag> 
      </ItemAsSold>
    - <ItemAsSold>
        <DistributorCode>INS</DistributorCode> 
        <CanOrderFlag>true</CanOrderFlag> 
        <CanShipFlag>true</CanShipFlag> 
      </ItemAsSold>
    - <ItemAsSold>
        <DistributorCode>ROM</DistributorCode> 
        <CanOrderFlag>true</CanOrderFlag> 
        <CanShipFlag>true</CanShipFlag> 
      </ItemAsSold>
    - <ItemAsSold>
        <DistributorCode>SHC</DistributorCode> 
        <CanOrderFlag>false</CanOrderFlag> 
        <CanShipFlag>false</CanShipFlag> 
      </ItemAsSold>
    </ItemsAsSold>
  </ItemAsMade>
- <ItemAsMade>
  <ManufacturerCode>SHC</ManufacturerCode> 
  <SupplierCode>SHC</SupplierCode> 
  <Currency>EUR</Currency> 
  - <ItemsAsSold>
    - <ItemAsSold>
       <DistributorCode>BER</DistributorCode> 
       <CanOrderFlag>true</CanOrderFlag> 
       <CanShipFlag>true</CanShipFlag> 
      </ItemAsSold>
    - <ItemAsSold>
       <DistributorCode>UKI</DistributorCode> 
       <CanOrderFlag>true</CanOrderFlag> 
       <CanShipFlag>true</CanShipFlag> 
      </ItemAsSold>
    - <ItemAsSold>
       <DistributorCode>INS</DistributorCode> 
       <CanOrderFlag>false</CanOrderFlag> 
       <CanShipFlag>false</CanShipFlag> 
      </ItemAsSold>
    - <ItemAsSold>
       <DistributorCode>ROM</DistributorCode> 
       <CanOrderFlag>false</CanOrderFlag> 
       <CanShipFlag>false</CanShipFlag> 
      </ItemAsSold>
    - <ItemAsSold>
       <DistributorCode>MEX</DistributorCode> 
       <CanOrderFlag>false</CanOrderFlag> 
       <CanShipFlag>false</CanShipFlag> 
      </ItemAsSold>
    - <ItemAsSold>
       <DistributorCode>SHC</DistributorCode> 
       <CanOrderFlag>true</CanOrderFlag> 
       <CanShipFlag>true</CanShipFlag> 
      </ItemAsSold>
  </ItemsAsSold>
 </ItemAsMade>
</ItemsAsMade>


--------Using the modified Code above, I now get the
following resultset-----

stringvalue="UKI,SHC"

--------When I should be getting the following
results------------
stringvalue="UKI,MEX,INS,ROM,SHC"


It has to be close, I tried moving the
CanOrderFlag/Ship into an xsl:if test outside the
loop, but that failed.
Any more help would be greatly appreciated!!!

Thanks!

-Rusty

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.