Dear BaseX team,

I think there is a bug in the determination of the static base URI in the special case that a base URI declaration contains a relative URI equal to or starting with "..".

Consider this declaration:
declare base-uri "..";

The effect should be that relative URIs are resolved against the PARENT directory of the directory containing the query.

If the query is located at, say, file:///a/b/c/query.xq, I would expect the static base-uri to be /a/b/, so that a URI like "abc.xml" would be resolved to file:///a/b/abc.xml.

However, the static base URI as determined by BaseX in this case misses the trailing /, it is: file:///a/b
The effect is that a URI like "abc.xml" would be resolved to file:///a/abc.xml
In other words: URIs are resolved against the "GRAND-PARENT" directory of the query.

Final remark: the effect of resolving URIs against the parent directory of the query is achieved by the surprising base URI declaration:

declare base-uri ".";

which is not what I would expect.

Conclusion: the way to achieve a resolving of relative URIs against the parent directory of the query should be achieved by the base URI declaration ".." - and no other value.

Kind regards,
Hans-Juergen

Full example:
Query ( file file:///projects/infospace/pcol/test.xq);

declare base-uri "..";
declare variable $uri external;

string-join((
          'query-file:      file:///projects/infospace/pcol/test.xq',
   concat('static-base-uri: ', static-base-uri()),
   concat('resolve-uri("try.xml")=', resolve-uri("try.xml"))
), '
')

Output:
query-file:                   file:///projects/infospace/pcol/test.xq
static-base-uri:           file:///C:/projects/infospace
resolve-uri("try.xml")=file:/C:/projects/try.xml