XML technologies / XPath / XPath 2.0: language reference / Path expressions: location steps / Inner and outer focus in path and predicate expressions
(Excerpt from "XSLT 2.0 & XPath 2.0" by Frank Bongers, chapter 4.)
An important aspect of an XPath expression’s focus is the distinction sometimes made between inner and outer focus while evaluating the expression and its subexpressions. This concerns compound path expressions and predicate expressions.
A compound path expression with at least two steps, of the form
ausdruck_1/ausdruck_2
or a predicate expression, a step with a filter condition, of the form
ausdruck_1[ausdruck_2]
has a focus for evaluating each of its subexpressions ausdruck_1 and ausdruck_2.
Evaluation proceeds from left to right. First, ausdruck_1 is evaluated, producing a sequence called the primary sequence, which becomes the current sequence. The evaluation of ausdruck_1 uses the context current at that time, therefore called the outer focus.
The items of the primary sequence produced by ausdruck_1 are used in turn as changing reference points for evaluating ausdruck_2. It is therefore evaluated once for each item in the primary sequence. This changing context is called the inner focus. It is temporary and exists only while the second expression is evaluated. Once evaluation of ausdruck_2 ends, the outer focus’s context node, position and size apply again.
Copyright © Galileo Press, Bonn 2008
You may print the online version for private use.
Otherwise, this chapter from "XSLT 2.0 & XPath 2.0 ― Das umfassende Handbuch" is subject to the same terms as the bound edition: the work and all its parts are protected by copyright. All rights reserved, including reproduction, translation, microfilming, storage and processing in electronic systems.
Galileo Press, Rheinwerkallee 4, 53227 Bonn