resolve-uri

Resolves a relative URI to a base URI, returning an absolute URI

Description

The fn:resolve-uri function takes a base URI ($base) and a relative URI ($relative) as arguments, and constructs an absolute URI.

If $base is not provided, the base URI of the static context is used. This may have been set by the processor outside the scope of the query, or it may have been declared in the query prolog.

Parameters

Description

relative:string()

the relative URI

base:string()

the base URI to resolve it to

Examples

XPath

Results

resolve-uri(‘prod’, ‘http://datypic.com/’)

http://datypic.com/prod

resolve-uri(‘prod2’, ‘http://datypic.com/prod1’)

http://datypic.com/prod2

resolve-uri(’http://example.org’,’http://datypic.com’)

http://example.org

resolve-uri(’http://datypic.com’, ‘../base’)

http://datypic.com

resolve-uri(‘’, ‘http://datypic.com’)

http://datypic.com

See Also