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

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

Usage

This function is largely cosmetic: when testing to see if nodes exist, some people prefer to write an expression such as
author[exists(child::element())]
over the more cryptic
author[*]
. But they have the same meaning.

Writing
exists()
explicitly is good practice when you are testing to see whether a sequence of atomic values (rather than nodes) is non-empty. This is because the effective boolean value of an atomic sequence is false not only when the sequence is empty, but also when it contains a single numeric zero, zero-length string, or boolean false value.

Writing
exists(X)
is precisely equivalent to writing
not(empty(X))
.

See Also

boolean()
on page 721

empty()
on page 770

not()
on page 850

false

This function returns the boolean value
false
.

Changes in 2.0

None.

Signature

There are no arguments.

Type
Meaning
Result
xs:boolean
The
xs:boolean
value false

Usage

There are no boolean constants available in XPath expressions, so the functions
true()
and
false()
can be used where a constant boolean value is required.

The most common usage is when passing an argument to a function that expects a boolean value.

XSLT Example

The following code calls a named template, setting the parameter
verbose
to
false
:

 

    

 

See Also

true()
on page 899

floor

The
floor()
function returns the largest integer value that is less than or equal to the numeric value of the argument. The result has the same type as the supplied value. For example, if the supplied value is an
xs:double
, then the result is returned as an
xs:double
.

For example, the expression
floor(11.3)
returns 11.0 (this is displayed as “11”, but it is actually a decimal value).

Changes in 2.0

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

Other books

Deliver Us from Evil by Ralph Sarchie
Sword Brothers by Jerry Autieri
The Lion in Autumn by Frank Fitzpatrick
Three by Brad Murray
Fragmented by Eliza Lentzski
Put What Where? by John Naish