|
[XQuery Talk Mailing List Archive Home] [By Date] [By Thread] [By Subject] [By Author] [Recent Entries] [Reply To This Message] Setting global variablesRonald Bourret rpbourret at rpbourret.comWed Oct 31 12:16:37 PST 2007
Hi, John, Unfortunately, this does not solve my problem. The name of the document can vary, so I can't simply initialize a variable. One possibility is to make the variable external to the library and then set it from the calling query. This would require an implementation-specific function -- I'm using Saxon -- and appears to violate the XQuery notion of not changing variable values. One could make the argument that external variables already violate the notion of not changing variable values to some extent, and extending that capability to libraries is not unreasonable. On the other hand, one could also argue that libraries are already parameterized through function arguments. -- Ron John Snelson wrote: > Hi Ronald, > > There is no way to do what you're asking, since XQuery is a functional > language and variable values cannot be changed. > > What's wrong with something like this: > > declare variable $foo:listOfNames := fn:doc("mydoc.xml")//Name; > > declare function foo:firstFunctionCalled(...) > { > ... > }; > > declare function foo:functionCalled MuchLater(...) > { > ... > if ($name = $foo:listOfNames) > ... > }; > > John
|
PURCHASE STYLUS STUDIO ONLINE TODAY!Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced! Download The World's Best XML IDE!Accelerate XML development with our award-winning XML IDE - Download a free trial today! Subscribe in XML format
|






