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.
Last update: 2014.
Table of Contents
About This Book
Introduction of XML (eXtensible Markup Language)
XML File Syntax
XML File Browsers
DOM (Document Object Model) Programming Interface
SAX (Simple API for XML) Programming Interface
DTD (Document Type Definition) Introduction
Syntaxes of DTD Statements
Validating an XML Document against the Specified DTD Document Type
XSD (XML Schema Definition) Introduction
Syntaxes of XSD Statements
Validating XML Documents Against Specified XML Schemas
XSL (Extensible Stylesheet Language) Introduction
XSLT (XSL Transformations) Introduction
Java Implementation of XSLT
►XPath (XML Path) Language
What is XPath (XML Path)?
Data Types, Literals and Variables
Expressions and Location Paths
Using XPath in XSLT Templates
XSLT Elements as Programming Statements
Control and Generate XML Element in the Result
XML Notepad - XML Editor
XML Tools Plugin for Notepad++
XML 1.1 Changes and Parsing Examples
PDF Printing Version