Loading TOC...

fn:escape-uri

fn:escape-uri(
   $uri-part as xs:string,
   $escape-reserved as xs:boolean
) as xs:string

Summary

This is a May 2003 function, and is only available in compatibility mode (XQuery 0.9-ML)--it has been replaced with fn:encode-for-uri, fn:iri-to-uri, and fn:escape-html-uri. Returns a string representing the specified URI either with escaped reserved characters ($escape-reserved=true) or with the reserved characters left as specified ($escape-reserved=true). For more details, see the W3C XQuery Functions and Operators specification.

Parameters
uri-part A string representing an unescaped URI.
escape-reserved Specify a boolean value of true to return an escaped URI or a boolean value of false to return an unescaped URI.

Example

fn:escape-uri("http://developer.marklogic.com", fn:true())

=> http%3A%2F%2Fdeveloper.marklogic.com

fn:escape-uri("http://developer.marklogic.com", fn:false())

=> http://developer.marklogic.com

Stack Overflow iconStack Overflow: Get the most useful answers to questions from the MarkLogic community, or ask your own question.