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

Other books

The Heart of Lies by Debra Burroughs
My Life As a Medium by Betty Shine
Pie and Pastry Bible by Rose Levy Beranbaum
Always For You (Books 1-3) by Shorter, L. A.
Echoland by Joe Joyce
Room 13 by Edgar Wallace
My Lady Below Stairs by Mia Marlowe
Lab Rats in Space by Bruno Bouchet