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
12.4Mb 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

A Million Shades of Gray by Cynthia Kadohata
Fangs in Frosting by Cynthia Sax
Sapphamire by Brown, Alice, V, Lady
Finding Justus by Bretz, Amanda
Zectas Volume III: Malediction of Veneficatl Valley by John Nest, Timaeus, Vaanouney, You The Reader
Human Blend by Pescatore, Lori
Siren's Song by Heather McCollum
torg 01 - Storm Knights by Bill Slavicsek, C. J. Tramontana