Dear Christian (and Dimitar),
Thanks for the hints!
Here's the next question then ;-)
(And I think the question may receive an easy answer in the context of the commandline, but I'm asking it in the context of the GUI, which I'm quite happy to use for my testing, before I move on to more serious scenarios)
Is there a way to pass a parameter to a query that I run in the GUI? I'm thinking of passing the path to the database to the query, so that it becomes a global parameter, and so that I can use that string as the argument to doc() inside my function, this way practically achieving what I wanted.
Thanks in advance and good night!
Piotr
On 24/01/12 22:52, Christian Grün wrote:
I would like to find a clean way of referencing the default context of my main module, where I can easily do "let $x := //whatever", but after I move this line to a function declaration.
I'm sorry, the context item will always be reset within functions both in XQuery 1.0 and 3.0, so the only way is to pass on the relevant node. A minor detail: If you put the doc() function inside the function instead of passing it on its result, you might benefit from some more optimizations, as a path expression can only be rewritten for index access if the accessed database is known at compile time.
Hope this helps, Christian