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

BOOK: XSLT 2.0 and XPath 2.0 Programmer's Reference, 4th Edition
10.59Mb size Format: txt, pdf, ePub
  • Boolean operators
    and
    and
    or

Many of these operators behave in much the same way as similar operators in other languages. There are some surprises, though, because of the way XPath handles sequences, and because of the way it mixes typed and untyped data. So don't skip this chapter just because you imagine that everything about these operators can be guessed.

Arithmetic Operators

These operators are normally used to perform calculations on numbers, which may be of any of the numeric types:
xs:integer
,
xs:decimal
,
xs:float
, or
xs:double
. They are also overloaded to perform calculations on dates and durations.

Note that this section only describes arithmetic operators built in to the XPath syntax. These operators are complemented by a range of arithmetic functions in the standard function library, described in Chapter 13. The functions in this library include
abs()
,
ceiling()
,
floor()
,
round()
,
round-half-to-even()
,
sum()
,
max()
,
min()
, and
avg()
.

Syntax

The syntax of expressions using the arithmetic operators is defined by the following syntax productions in the XPath grammar.

Expression
Syntax
AdditiveExpr
MultiplicativeExpr ((
+
|
-
) MultiplicativeExpr )*
MultiplicativeExpr
UnionExpr ((
*
|
div
|
idiv
|
mod
) UnionExpr )*
UnaryExpr
(
-
|
+
)* PathExpr

Other books

Alma Mater by Rita Mae Brown
Black-Eyed Stranger by Charlotte Armstrong
Younger Gods 1: The Younger Gods by Michael R. Underwood
Spirit of the Wolf by Vonna Harper
When Dove Cries by Beth D. Carter
Smitten by Vivienne Savage
Enjoy Your Stay by Carmen Jenner
The Third Bear by Jeff Vandermeer