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

RE: How can I get context node in this complex expresi

Subject: RE: How can I get context node in this complex expresion? (current( ) didn't work)
From: "Michael Kay" <mike@xxxxxxxxxxxx>
Date: Wed, 4 May 2005 22:26:50 +0100
michael stuardo
Can't be done in a single XPath 1.0 expression - you need to build up the
result of the XPath expression in a series of variables declared at the XSLT
level.

In XPath 2.0 you use the "for" expression to bind variables at any level of
nesting, for example,

<xsl:apply-templates 
   select="ROW[for $x in COB_ID return $x =
$cob_rowset[CXC_CAD_ID=key('cad_key_ori', 
   $cob_rowset[COB_ID = $x]/CXC_CAD_ID)/CAD_REL_ID]/COB_ID]">

I'm assuming a ROW has only one COB_ID, otherwise these aren't equivalent. 

Michael Kay
http://www.saxonica.com/



> -----Original Message-----
> From: Jaime Stuardo [mailto:jstuardo@xxxxxxxxxxx] 
> Sent: 04 May 2005 22:10
> To: xsl-list@xxxxxxxxxxxxxxxxxxxxxx
> Subject:  How can I get context node in this complex 
> expresion? (current( ) didn't work)
> 
> Hi all...
> 
> This is the real case I have:
> 
> <xsl:apply-templates 
> select="ROW[COB_ID=$cob_rowset[CXC_CAD_ID=key('cad_key_ori', 
> $cob_rowset[COB_ID = 2]/CXC_CAD_ID)/CAD_REL_ID]/COB_ID]">
> 
> where:
> 	$cob_rowset : a nodeset that I assign previously. It is 
> correctly assigned.
> 	'cad_key_ori' a key that is correctly defined as well.
> 
> That expresion works the way I want (showing some records 
> according to the predicate). But that is a particular case. 
> The general case is replacing the '2' above for the node 
> COB_ID whose parent is ROW. For instance, I tried:
> 
> <xsl:apply-templates 
> select="ROW[COB_ID=$cob_rowset[CXC_CAD_ID=key('cad_key_ori', 
> $cob_rowset[COB_ID = 
> current()/COB_ID]/CXC_CAD_ID)/CAD_REL_ID]/COB_ID]">
> 
> The call to current() didn't work (it didn't show anything 
> and I know that 'COB_ID=2' is present in ROW nodeset). I 
> think it is because current() is pointing to $cob_rowset context node.
> 
> Any help would be greatly appreciated.
> 
> Thanks
> Jaime

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.