[XQuery Talk Mailing List Archive Home] [By Date] [By Thread] [By Subject] [By Author] [Recent Entries] [Reply To This Message]

using a context node in a for loop

David Carlisle davidc at nag.co.uk
Tue Oct 17 17:05:03 PDT 2006


  using a context node in a for loop
> Should the function below work?
no:-)

a function does not automatically pass the current context, 
. is undefined in a function body, so you can't use relative paths like
'@id and @db-ref

Built in functions can take an empty param list () and automatically work on
the current node, but user defined ones can not do that: you have to call
it as

local:display-user-groups(.)
                          ^

and define it as

declare function local:display-user-groups($here as element()) as
element()* {
...
then use $here/@id  $here/@db-ref

or give yourself a current node again by 
$here/
(for $user-group ....
in which case you can use {@id} as you have now.

(The same is true for xslt2 functions by the way)

David


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-2007 All Rights Reserved.