Loading TOC...

MarkLogic 12 EA 2 Product Documentation
xdmp.resolveUri

xdmp.resolveUri(
   relative as String?,
   [base as String]
) as String?

Summary

Resolves a relative URI against an absolute URI. If $base is specified, the URI is resolved relative to that base. If $base is not specified, the base is set to the base-uri property from the static context, if the property exists; if it does not exist, an error is thrown.

Parameters
relative A URI reference to resolve against the base.
base An absolute URI to use as the base of the resolution.

Usage Notes

This function is the same as fn.resolveUri, but always accepts a relative base URI. The fn.resolveUri, function raises an error in this case in standards compatible dialects.

If $base is specified, it is assumed to be an absolute URI and $relative is assumed to be an absolute or a relative URI reference. If $relative is a relative URI reference, it is resolved against $base, using an algorithm such as the ones described in [RFC 2396] or [RFC 3986], and the resulting absolute URI reference is returned.

If $relative is the zero-length string, fn.resolveUri, returns the value of $base, or the base-uri property from the static context if there is no $base value specified (if the base-uri property is not initialized in the static context, an error is raised).

Resolving a URI does not dereference it. This is merely a syntactic operation on two character strings.

Example

xdmp.resolveUri("hello/goodbye.xml",
     "/mycompany/default.xqy");

=>  /mycompany/hello/goodbye.xml

Stack Overflow iconStack Overflow: Get the most useful answers to questions from the MarkLogic community, or ask your own question.