separate base URI's for xquery modules+doc

David Lee
  • David Lee
    David Lee

    I havent yet issolated this to a small standalone test but this is what I'm
    seeing in my larger app.
    Using s9API XQueryComnpiler

    If I call setBaseURI passing in the absolute path of the xquery main module,
    not only do module references use this URI
    but also doc("file.xml") references. Otherwise if I do not set the baseURI
    then both module and doc references use the current directory.

    Is this intentional ? Is there a way to set keep the doc() base URI as the
    current directory but let the module base URI be relative to the .xquery file

    I am using a ModuleURIResolver but for a different purpose (to locate a
    builtin functx packge).

    Could/Should I use the ModuleURIResolver to override the default directory for
    xquery modules (set to current directory)
    and use setBaseURI for the doc() functions ?

    Thanks for any suggestions.

  • Michael Kay
    Michael Kay

    The query has a single static base URI and this is used for resolving all
    relative URIs appearing within the query including those in module location
    hints and those in calls to the doc() function. There may be some way around
    this using the various URI resolvers but I wouldn't swear to it; it would be
    against the spirit of the W3C specs. What you can do, of course, is to resolve
    relative URIs passed to doc() yourself by using resolve-uri().

    Michael Kay