XSLT 2.0 and XPath 2.0 Programmer's Reference, 4th Edition (579 page)

BOOK: XSLT 2.0 and XPath 2.0 Programmer's Reference, 4th Edition
2.47Mb size Format: txt, pdf, ePub
ads

Signature

Argument
Type
Meaning
value
xs:string?
The input string, to which URI escaping is to be applied. An empty sequence is treated as a zero-length string.
Result
xs:string
The URI in its escaped form, as a string
.

Effect

As the name of the function suggests, its purpose is to take an IRI as input and produce a valid URI by escaping those characters that are allowed in an IRI but not in a URI. For completeness, it also escapes those characters that are not allowed in an IRI.

An IRI is essentially a URI in which non-ASCII characters are permitted; for example, the string
http://www.münchen.de/
is a valid IRI, but it is not a valid URI. Applying this function would convert this IRI to
http://www.m%C3%BCnchen.de/
. (Whether this is actually a useful thing to do is a separate matter—current browsers accept this IRI with the
ü
, but reject it after percent-encoding.)

The result string is formed from the input string by escaping special characters according to the rules defined in RFC 3986. Special characters are escaped by first encoding them in UTF-8, then representing each byte of the UTF-8 encoding in the form %HH, where HH represents the byte as two hexadecimal digits. The digits A–F are always in upper case.

The characters that are considered “special” in this definition are characters outside the range x21 to x7E, together with
<
,
>
,

,
{
,
}
,
|
,
\
,

BOOK: XSLT 2.0 and XPath 2.0 Programmer's Reference, 4th Edition
2.47Mb size Format: txt, pdf, ePub
ads

Other books

The Ragged Heiress by Dilly Court
In Bed with Jocasta by Richard Glover
The Sunfire by Mike Smith
Touch If You Dare by Rowe, Stephanie
Kell's Legend by Andy Remic
Something Good by Fiona Gibson
The Seventh Suitor by Laura Matthews