missing in the result. I noticed it's quite a hassle to implement all
not comply 100% with RFC 3986.
I have added a new GitHub issue [1].
some XQuery implementations, they all gave me different results...
On Fri, Jan 23, 2015 at 11:09 PM, Hans-Juergen Rennau <
hrennau@yahoo.de> wrote:
> 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
>
>