Applies the URI escaping rules to $string-var that contains a URI (Uniform Resource Identifier Reference).
If the value of $string-var or $boolean-var 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 escape-URI invocation: expected type [string@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.
xf:escape-URI(xs:string $string-var, xs:boolean $boolean-var) —> xs:string
Represents the conversion string that contains the URI (Uniform Resource Identifier Reference) |
||
Represents the boolean that determines the URI escaping rules to apply. |
||
All characters are escaped except the following:
The "%" character is escaped only if it is not followed by two hexadecimal digits (0-9, a-f, or A-F). |
||
In addition to the characters defined in the true section of this table as not being escaped, the following reserved characters are not escaped: ";" | "/" | "?" | ":" | "@" | "&" | "=" | "+" | "$" | ",". (As defined by RFC 2396 .) Typically, this option is used to escape an entire URI or URI reference. |
Returns the $string-var after the URI escaping rules have been applied. The rules applied are different depending on the value of $boolean-var.
The following example query shows the escape-URI function called with the $boolean-var argument set to true:
<true>{xf:escape-URI("http://www.acme.org/", xs:boolean("true"))}</true>
The preceding query generates the following result:
<true>http%3A%2F%2Fwww.acme.org%2F</true>
The following example query shows the escape-URI function called with the $boolean-var argument set to false:
<false>{xf:escape-URI("http://www.acme.org/widget/201/#specs",xs:boolean("false"))}</false>
The preceding query generates the following result:
<false>http://www.acme.org/widget/201/%23specs</false>
W3C escape-uri function description.