This section provides a quick introduction of evaluation context: current node, current position, number of nodes of the current node set, and current variables.
XPath expressions are always evaluated with respect to a context, which consists of:
Context node: A node referring to the current node in the source XML structure.
Context position: An integer indicating position of the context node in the current node set.
Context size: An integer indicating the number of nodes in the current node set.
Variable bindings: A collection of pairs of variable names and values.
The context node is referring to the current node in the source XML structure, which is
represented as a tree of different types of nodes according to the Document Object Model (DOM):
Root node: The top and first node of the XML structure.
Element node: A node that has child nodes.
Text nodes: A node represents a unit of text in the content of a parent node.
Attribute node: A node represents an attribute.
Namespace node: A node represents a name declaration statement.
Processing instruction node: A node represents a processing instruction statement.
Comment node: A node represents a comment statement.
For more details, tutorial notes on DOM in other chapters of this book.