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 TypeName | Type | Description |
$relative |
xs:string? |
the relative URI |
$base |
xs:string |
the base URI to resolve it to |
return value |
xs:anyURI? |
ExamplesXPath Example | 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 |
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 AlsoHistory |
Recommended Reading:
|