xf:resolve-URI

Resolves the relative URI $anyURI-var1 against the base URI $anyURI-var2. To learn about URI resolution, see the javadoc for the URI class.

If the value of $anyURI-var1 or $anyURI-var2 is the empty sequence, the following error is displayed in the mapper:

Error occurred while executing XQuery: Error loading the XQuery or XSLT for this method: Type error in function resolve-URI invocation: expected type [anyURI@http://www.w3.org/2001/XMLSchema], given type empty 

The empty sequence is a sequence containing zero items (), which is similar to null in SQL.

Signatures

xf:resolve-URI(xs:anyURI $anyURI-var1, xs:anyURI $anyURI-var2) —> xs:anyURI

Arguments

Data Type
Argument
Description

xs:anyURI

$anyURI-var1

Represents the base URI.

xs:anyURI

$anyURI-var2

Represents the relative URI.

Returns

Returns the absolute URI (of data type anyURI) which is result of the relative URI $anyURI-var1 being resolved against the base URI $anyURI-var2.

Returns the relative URI $anyURI-var2, if $anyURI-var2 is an absolute URI.

Example

Resolve-URI Example 1

The first example of an query invoking the resolve-URI function:

<resolve-URI-1>
{xs:string(xf:resolve-URI("http://www.ics.uci.edu/pub/ietf/uri/#Related", "priv#internal"))}
</resolve-URI-1> 

The preceding query generates the following result:

<resolve-URI-1>http://www.ics.uci.edu/pub/ietf/uri/priv#internal</resolve-URI-1> 

Resolve-URI Example 2

The second example of an query calling the resolve-URI function:

<resolve-URI-2>
{xs:string(xf:resolve-URI("http://www.ics.uci.edu/pub/", ".././priv/./../priv#internal"))}
</resolve-URI-2> 

The preceding query generates the following result:

<resolve-URI-2>http://www.ics.uci.edu/priv#internal</resolve-URI-2> 

Resolve-URI Example 3

The third example of an query calling the resolve-URI function:

<resolve-URI-3>
	{xs:string(xf:resolve-URI("http://www.ics.uci.edu/", "priv"))}
</resolve-URI-3> 

The preceding query generates the following result:

<resolve-URI-3>http://www.ics.uci.edu/priv</resolve-URI-3> 

Related Topics

W3C resolve-URI function description.

JDK 1.4.1 URI class description.