I'm migrating XSLT functions for working with DITA documents to XQuery. As part of this function package I have functions that resolve URI references from one document to another. This involves creating absolute URLs from relative URLs using a document or element as the base URI context.
The problem I'm running into is that the URLs used within BaseX are not absolute (that is, they don't start with "/".
For example, document-uri(root($node)) returns:
dfst^dfst-sample-project^develop/docs/tests/complex_map/complex_map.ditamap
not
/dfst^dfst-sample-project^develop/docs/tests/complex_map/complex_map.ditama p
This causes a problem for resolve-uri(), used like this:
resolve-uri($topicResourcePart, base-uri($topicref))
This fails under BaseX:
[FORG0002] Base URI is not absolute: "dfst^dfst-sample-project^develo....
These libraries are intended to be generic XQuery so I'm trying to avoid having any BaseX-specific logic in these functions.
Is there workaround or other solution to this?
Obviously, this way of representing document URIs internally is not something that could be easily changed but it is definitely a problem in terms of the expectations of URI handling by built-in XQuery functions.
Thanks,
Eliot ————— Eliot Kimber, Owner Contrext, LLC http://contrext.com