AxisStep

Create and possibly filter a sequence of nodes.

Top of page

Related Syntax Constructs

The following construct(s) refer to this construct:


Syntax

AxisStep

graphics/AxisStep.png

Axis NodeTest StepQualifiers AbbreviatedStep

Description

An AxisStep is a step expression that creates a sequence of nodes. Beginning at the context node, it takes a step in forward or reverse direction of the given axis.

The unabbreviated form requires a node test that checks whether the node is of a certain kind or whether it passes a name test. You can specify a predicate expression by using StepQualifiers to filter the current sequence of nodes.

The abbreviated form allows you to use shorthand notations for the axes self, parent and attribute.

Example

  • Select all books written by Stevens:

    input()/descendant-or-self::book[child::author/child::last = "Stevens"]

    Starting from the document node, this query uses the unabbreviated form to take a step on the descendant-or-self axis and adds any book (NodeTest) to the sequence. Those elements are retained that satisfy the following predicate expression (StepQualifiers): there is a child element node author that has a child element node last whose string value is "Stevens".