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
5.27Mb size Format: txt, pdf, ePub
ads

, 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’)
.

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

Other books

Wicked Wager by Mary Gillgannon
Murder on the Blackboard by Stuart Palmer
Tough Customer by Sandra Brown
Tide of Fortune by Jane Jackson
The Darke Crusade by Joe Dever
Evan's Gate by Bowen, Rhys
Dragon Haven by Robin Hobb