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
6.43Mb size Format: txt, pdf, ePub
ads
  • , 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.

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

Other books

Knight's Gambit by William Faulkner
Sunny Daze by R.J. Ross
Oranges Are Not the Only Fruit by Jeanette Winterson
The Dark Story of Eminem by Hasted, Nick
Just Rules by Anna Casanovas, Carlie Johnson
Scattered Leaves by V. C. Andrews
Chronicles of Eden - Act 2 by Alexander Gordon