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

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

and
3
.

When you take a substring of a normalized string, the substring will always be normalized, and this is true for all the normalization forms discussed here. Splitting a string between a letter
c
and a non-spacing cedilla that follows it may not produce a very meaningful result, but the result is normalized, in the sense that the normalization algorithm will not change it. However, concatenating two normalized strings is not guaranteed to produce a normalized string. This is true whether you choose a composed form (NFC) or a decomposed form (NFD):

  • With NFC, concatenating a string that ends with letter
    c
    and a string that starts with a non-spacing cedilla produces a string that is not in normalized form NFC.
  • With NFD, concatenating a string that ends with a non-spacing modifier and a string that starts with a non-spacing modifier may produce a string that is not in normalized form NFD, because this normalization form requires multiple non-spacing modifiers applying to the same letter to be in a standard order.

This means that the
concat()
function, and other XPath functions that concatenate strings such as
string-join()
, as well as node construction instructions in XSLT and XQuery, are not guaranteed to produce normalized output even if they are given normalized input. Another place where string concatenation occurs implicitly is in forming the string value of an element with mixed content. The W3 C policy of early normalization means that this problem should be corrected as soon as possible. One way of doing this is to call the
normalize-unicode()
function on the results of the string concatenation; another is to do the normalization at the time the result of a transformation or query is serialized (see the
normaliation-form
option of

, described in Chapter 15).

The term
fully-normalized
refers to an additional normalization format defined by W3 C (see
Character Model for the World Wide Web: Normalization
,
http://www.w3.org/TR/charmod-norm/
). A string is defined to be fully normalized if it is in NFC and if it doesn't start with a combining character. The significance of this is that if you concatenate two fully normalized strings the result is guaranteed to be fully normalized as well. The specification isn't very explicit about how you get a string into fully-normalized form, but the idea is apparently that if it starts with a combining character, you add a space in front of it.

See Also

Serialization, Chapter 15

not

The
not()
function returns
true
if the effective boolean value of the argument is
false
, and vice versa.

For example, the expression
not(2+2=4)
returns
false
.

Changes in 2.0

This function has been generalized to accept a wider range of types.

Signature

Argument
Type
Meaning
value
item()*
The input value
Result
xs:boolean
true
if the effective boolean value of the argument is false, otherwise
false

Effect

In effect, the argument is converted to a boolean using the rules of the
boolean()
function, and the return value is then
true
if this is
false
,
false
if it is
true
.

The rules for determining the effective boolean value are described under the
boolean()
function on page 721. If the value is one that does not have an effective boolean value (for example, a sequence of three integers), then an error is reported.

Examples

Expression
Result
not(*)
true
if the context node has no child elements
not(normalize-space(@a))
true
if attribute
@a
is absent, is zero-length, or consists entirely of whitespace
not(author=“Kay”)
true
if the context node does not have an author child element whose typed value is
“Kay”

Usage

Note that writing
not($A=2)
is not the same thing as writing
$A!=2
. The difference arises when
$A
is a sequence:
not($A=2)
will be
true
if
$A
does not contain an item that is equal to 2, while
$A!=2
is
true
only if A
does
contain an item that is
not
equal to 2. For example, if
$A
is an empty sequence,
not($A=2)
will be
true
, while
$A!=2
will be
false
.

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

Other books

Tag Along by Tom Ryan
Swansong by Damien Boyd
My Life: The Musical by Maryrose Wood
Child Bride by Suzanne Forster
Opal by Jennifer L. Armentrout
Langdown Manor by Sue Reid
Twisted by Laurie Halse Anderson
Demon Song by Cat Adams