XML technologies / XSLT / Introduction to XSLT 2.0 / Getting started with XSLT and XPath / Path expressions – examples / KindTests on element axes
(Excerpt from "XSLT 2.0 & XPath 2.0" by Frank Bongers, Chapter 1.)
To select unnamed nodes on the chosen axis, use a KindTest that identifies the node kind. XPath 2.0 has a separate KindTest for each node kind:
node()
matches every node on the selected axis, regardless of its kind.text()
matches all text nodes on the selected axis.comment()
matches all comment nodes on the selected axis.processing-instruction()
matches all processing instruction nodes.document-node()
matches every document node. This KindTest does not yet exist in XPath 1.0. It is irrelevant for writing path expressions, where the abbreviation »/« is used for the document node.
There are also KindTests for element nodes and, to be used on the attribute axis, for attribute nodes. A separate KindTest for namespace nodes is unnecessary because they do not appear on element axes.
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