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

BOOK: XSLT 2.0 and XPath 2.0 Programmer's Reference, 4th Edition
3.11Mb size Format: txt, pdf, ePub
  • , the first node in
    $S
    would be dropped only if every
    A
    has exactly one
    B
    child.
  • Finally,
    /
    is not associative when one step selects nodes and another selects atomic values. For example,
    (A/..)/name()
    selects one node (the parent of all the A children, that is, the node you started from) and then selects its name. However,
    A/(../name())
    repeats the name of the parent node as many times as there are
    A
    nodes.

These examples are fairly pathological, but you might like to try them out on your chosen XPath processor to see how well it handles them. There may well be much simpler path expressions in which
/
is not associative, but I haven't discovered them yet!

Axis Steps

This section discusses the expressions called axis steps. Axis steps are often used as operands of the
/
operator in a path expression, which is how they got their name (a path consists of many steps). But an axis step is an expression in its own right, and it can be used on its own without any need for a
/
operator. We've also seen that XPath 2.0 allows the operands of
/
to be any kind of expression, they are no longer constrained to be axis steps. So the
/
operator and axis steps have become quite decoupled in the semantics of the language. However, they are so often used together that it makes sense to retain the term
path expression
to describe any expression that uses either a
/
operator or an axis step or both.

Other books

A Regency Christmas My Love by Linda Hays-Gibbs
THE ONE YOU CANNOT HAVE by SHENOY, PREETI
Beyond the Pale: A Novel by Elana Dykewomon
Curby by Del Valle, Adrian
Justified by Varina Denman
Temptation by Nora Roberts