Hi Christian, I have used this technique and it works unless the query string already has a base-uri set. I wonder if there is a case for adding base-uri to the xquery:eval options map to handle this in a cleaner way? /Andy On 19 Feb 2016 07:10, "Marc van Grootel" marc.van.grootel@gmail.com wrote:
Yes, exactly what I was after. Thanks and good night :)
--Marc
On 18 feb. 2016, at 23:38, Christian Grün christian.gruen@gmail.com
wrote:
Hi Marc,
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.
You could add a base-uri declaration in your query:
let $uri := 'a/b/c' let $query := '1' return xquery:eval( 'declare base-uri "' || $uri || '"; ' || $query )
Does this help? Christian
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