Hi,
I am having quite some fun with xquery:eval. I am working on a little module for executable documentation (similar to Python doctest). I want to write documentation in asciidoc, parse it and execute source code blocks inside the asciidoc. Parsing works by calling asciidocj and so far I can run simple queries, evaluate them, compare them with an expected outcome and write the result back as evaluated asciidoc.
Now I want to tackle more advanced queries that import modules. But when running xquery:eval with a string it will try to resolve paths relative to the code module and not relative to the file the string came from. Ideally I would like to be able to set the base-dir for xquery:eval. The asciidoc file isn't always in the correct path relative to the module that I need to import.
Other options I'm considering but are less ideal.
- Manipulate the module import paths in the query string using regexps - Writing out to a temp file and then use xquery:parse-uri (but this is tricky as I may not want to clutter existing directories with tempfiles only to have the imports work).
Unless there are better options I think I'll opt for string massaging using regexps. But maybe someone has a better idea.
--Marc