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

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

There has been a lot of confusion about whether and where hyphens are allowed within square brackets, other than their two special meanings to indicate a codepoint range such as
[0-9]
and a subtraction such as
[A-Z-[IO]]
. At one stage an erratum was issued making any usage such as
[+-]
invalid, but this was subsequently withdrawn. In the second edition of XML Schema Part 2, the grammar and the textual narrative are inconsistent. If you want to be safe, escape any hyphen that is intended to represent the hyphen character itself, for example
[+\-]
.

Single character escapes
are described in the following section.

Character Class Escapes

The next table describes various constructs introduced with a backslash (
\
). These constructs are known collectively as
character class escapes
(
charClassEsc
); each character class escape defines a subset of the Unicode character set, and it can appear either at the top level of a regular expression (as an atom), or within square brackets. Within this category, a
single character escape
(
SingleCharEsc
) represents a single Unicode character; these can also appear as the start or end of a character range, as we saw in the previous section.

Construct
Syntax
charClassEsc
SingleCharEsc | MultiCharEsc | catEsc | complEsc
SingleCharEsc
\
(
n
|
r
|
t
|
\
|
|
|
.
|
?
|

Other books

The Firefighter's Match by Allie Pleiter
The Killing Code by Craig Hurren
Apache by Ed Macy
Matriarch by Karen Traviss