XML technologies / XSLT / Introduction to XSLT 2.0 / Getting started with XSLT and XPath / Path expressions – examples / Selecting the context — the self axis
(Excerpt from "XSLT 2.0 & XPath 2.0" by Frank Bongers, Chapter 1.)
It is also useful to be able to evaluate the evaluation context itself using a relative path expression. This requires a step that effectively stays in place. A step on the self axis meets this requirement. The context node is represented by a period, “.” (familiar from UNIX as the current directory):
.
The period.represents the current context (usually a node), in other words the current position of the processing operation. It is therefore a neutral location step. This can also be written out more verbosely:self::node()
The equivalent expanded form makes it clear that the context node need not be an element. The neutral kind testnode()also matches all other node types. The actual name, if any, is irrelevant../gruss
This expression consisting of two steps is entirely valid. However, since the first step.denotes the context node itself, wherever it may be, it means exactly the same as the relative path expressiongruss.
Copyright © Galileo Press, Bonn 2008
You may print the online version for your private use.
Otherwise, this chapter from "XSLT 2.0 & XPath 2.0 ― Das umfassende Handbuch" is subject to the same terms as the printed edition: the work and all its parts are protected by copyright. All rights are reserved, including reproduction, translation, microfilming, and storage and processing in electronic systems.
Galileo Press, Rheinwerkallee 4, 53227 Bonn