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

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

, and
'
. Note that this includes the space character, which will be encoded as %20.

If a
%
character occurs in the input string, it will
not
be escaped as
%25
.

Examples

Expression
Result
iri-to-uri(“simple.xml”)
“simple.xml”
iri-to-uri(“http://w3.org/simple.xml”)
“http://w3.org/simple.xml”
iri-to-uri(“my doc.xml”)
“my%20doc.xml”
iri-to-uri(“Grüße.html”)
“Gr%C3%BC%C3%9Fe.html”
iri-to-uri(“100% Java.html”)
“100%%20Java.html”

Usage

Although IRIs (Internationalized Resource Identifiers) are not very often mentioned, an increasing number of interfaces and protocols actually accept them even though they may still use the term URI. Technically, a URI does not allow non-ASCII characters. This function allows you to bridge from an environment where IRIs are allowed (whether officially or unofficially) to a world where they are not recognized.

The handling of percent signs can cause problems, because two different IRIs, for example
My Documents
and
My%20Documents
, will be converted to the same URI, which means that the conversion cannot be accurately reversed. If you know that any percent signs in the input string genuinely represent a percent character rather than signalling an escape sequence, then it is a good idea to convert them to
%25
before calling this function. This can be done by calling
replace($in, ‘%’, ‘%25’)
.

Other books

K is for Kinky by Alison Tyler
Bones & Silence by Reginald Hill
Iron Wolf by Dale Brown
Jack by Cat Johnson
The Prodigal Spy by Joseph Kanon
Pixilated by Jane Atchley
Set in Stone by Frank Morin
The Ravi Lancers by John Masters
The Eyes of the Dead by Yeates, G.R.