home contribute faq download

FunctX XSLT Functions

fn:resolve-uri

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

Google
Webxsltfunctions.com

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.

This description is © Copyright 2007, Priscilla Walmsley. It is excerpted from the book XQuery by Priscilla Walmsley, O'Reilly, 2007. For a complete explanation of this function, please refer to Appendix A of the book.

Arguments and Return Type

NameTypeDescription
$relative xs:string? the relative URI
$base xs:string the base URI to resolve it to
return value xs:anyURI?

Examples

XPath ExampleResults
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
The following examples assume that the base URI of the static context is http://datypic.com:
resolve-uri('prod')
http://datypic.com/prod
resolve-uri('')
http://datypic.com

See Also

fn:base-uriThe base URI of a node
functx:is-absolute-uriWhether a URI is absolute
fn:encode-for-uriEncodes reserved characters for use in the path of a URI

History

Published OnLast UpdatedContributor(s)
2006-06-272007-02-26W3C, XQuery 1.0 and XPath 2.0 Functions and Operators, http://www.w3.org/TR/xpath-functions/
Datypic XSLT Services

Recommended Reading:

XQuery