I'm fairly new to XQuery and only started to use it and BaseX last week. So far I've been very impressed with the capabilities of both.
I have one question about user-defined functions. From what I can tell so far that I learned about XQuery, user-defined functions are only accessible when they are declared in the prolog of the query. In itself I suppose there's a certain logic to that. My project is most likely very atypical from your average XQuery usage, but it would be much more convenient, and probably also much more efficient if I could somehow (optionally) declare user-defined functions and reuse them for several queries in a row.
I don't think importing a module would be a solution because a) that would be even more inefficient and b) I don't think it wouldn't work with dynamically created functions. (I'm executing queries that contain queries that get executed...)
So I was wondering if there's a way to accomplish this. And even if this is currently not possible, would it be complicated for an accomplished Java developer to add as a custom extension? Any tips or ideas will be greatly appreciated.
Mark