The XPath Context
The context in an XPath expression consists of several things:
- Context node
The node currently being evaluated.
- Context position
A nonzero positive integer that indicates the position of the context node within the set of context nodes.
- Context size
A nonzero positive integer that indicates the number of nodes in the current context.
- Variable bindings
A set of variables that are in scope for the current context. Each one is represented by a variable name and an object that represents its value. The object might be one of the four XPath datatypes, some additional type defined by an extension, or some other entity.
- Functions
A set of functions visible to the current context. Each function is represented by a mapping between a function name and the actual code to be invoked. Each function takes zero or more arguments and returns a single result. XPath defines a number of core functions that are always available; XSLT defines additional functions that go beyond those defined in the XPath specification.
- Namespace declarations
The set of namespace declarations visible to the current context. Each one consists of a namespace prefix and the URI with which it is associated.