Hi Chas,
i actually don't understand what your concrete problem is, but you could have a look in our xquery database functions: http://www.inf.uni-konstanz.de/dbis/basex/xq-db
If you have opened the database before running queries, the whole database is in your context and so it is used in the queries.
Kind regards, Andreas
Am 04.01.11 00:54, schrieb Charles F. Munat:
I have an embedded Base-X database in a web application. I have a huge XQuery that involves a lot of local functions, many of them recursive. In several of these functions, I need to query the database to look up referenced elements. I can't for the life of me figure out a way to access the database without doing one of two things:
- My document root is /data. I can let $root := /data and then pass
that into every function. Passing things into functions rather than setting global variable is certainly and FP way of doing things, but in this instance it seems to me that it should be the scope I'm working in.
- If something else I pass into the function is a node in the
database, then I can, for example, use $node/root() to back up to the root node. But sometimes I'm only passing in a string and I still need to query the whole database.
Is there some way to access the root easily from within a function? I am very confused by the whole "context" idea. I've looked all over, but I must be searching using the wrong terms, or it simply isn't done.
Anyone know a way?
Thanks,
Chas. _______________________________________________ BaseX-Talk mailing list BaseX-Talk@mailman.uni-konstanz.de https://mailman.uni-konstanz.de/mailman/listinfo/basex-talk