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

The Generation Game by Sophie Duffy
Dance of the Years by Margery Allingham
Within a Man's Heart by Tom Winton
Jack and Susan in 1933 by McDowell, Michael
Fox River by Emilie Richards
Briar's Cowboys by Brynn Paulin
The Great Quarterback Switch by Matt Christopher
The Wedding Night by Linda Needham
In the Flesh by Clive Barker