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

Re: XSL For-Each Help!

Subject: Re: XSL For-Each Help!
From: Wendell Piez <wapiez@xxxxxxxxxxxxxxxx>
Date: Tue, 18 Jul 2006 11:05:42 -0400
Re:  XSL For-Each Help!
Rusty,

These turned out to be pretty simple errors to make (and fix):

At 07:06 PM 7/17/2006, you wrote:
<xsl:key name="itemsbydistributor"
match="ItemAsSold[CanOrderFlag='true'][CanShipFlag =
'true']" use="DistributorCode"/>

In your data (as posted yesterday), the elements in the predicates are CanOrder and CanShip, without "Flag" appended.


--then down within the XSL file i have----:
<xsl:variable name="distributorVal">
<!-- only process distributorCodes if canShip and
canOrder are both true -->
   <xsl:for-each
select="//DistributorCode[generate-id(parent::ItemAsSold)=generate-id(key('itemsbydistributor',current())[1])
]">

Here, you want generate-id(key('itemsbydistributor',.)[1], no "current()". If that was my error, I apologize. :-) (If this is a global variable, current() is probably returning the root node. You want the value of the DistributorCode.


<xsl:value-ofselect="DistributorCode"/>

Here you want value-of select=".", since the context is already the DistributorCode.


Alternatively, you could select
 //ItemAsSold[generate-id()=generate-id(key('itemsbydistributor',DistributorCode)[1])]

and then get the value of its DistributorCode.

I hope that helps.

Do you get the concept, anyhow?

Cheers,
Wendell

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.