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

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

, and it concatenates the two-item sequence
1, 2
with the one-item sequence
3
to produce the three-item sequence
1, 2, 3
. This definition of comma as an operator means that it is also possible to write sequences such as
$a, $b
, which concatenates two arbitrary sequences represented by the variables
$a
and
$b
.

Sometimes a list of values separated by commas needs to be enclosed in parentheses to prevent ambiguity, for example when it is used as an argument in a function call. For details, see Chapter 10, page 635.

Some of the important XPath operations defined on sequences are:

  • count($S)
    counts the items in a sequence.
  • $S, $T
    concatenates two sequences.
  • $S[predicate]
    selects those items in a sequence that satisfy some condition.
  • $S[number]
    selects the
    N
    th item in a sequence.
  • for $item in $SEQ return f($item)
    applies the function
    f
    (which can actually be any expression) to every item in the sequence
    $SEQ
    , and returns the results as a new sequence. (In list processing languages, this is known as a
    mapping
    expression).
BOOK: XSLT 2.0 and XPath 2.0 Programmer's Reference, 4th Edition
9.4Mb size Format: txt, pdf, ePub
ads

Other books

The Eleventh Commandment by Lutishia Lovely
The Forgotten City by Nina D'Aleo
Medstar I: Médicos de guerra by Steve Perry Michael Reaves
Liar by Justine Larbalestier
Over the Net by Jake Maddox
Hip Check (New York Blades) by Martin, Deirdre
Give a Little by Kate Perry