Read XSLT 2.0 and XPath 2.0 Programmer's Reference, 4th Edition Online
Authors: Michael Kay
Examples of Axis Steps
Expression | Description |
child::title | Selects child elements of the context node named |
title | Short form of child::title . |
attribute::title | Selects attributes of the context node named title . |
@title | Short form of attribute::title . |
ancestor::xyz:* | Selects ancestor elements of the context node whose names are in the namespace with prefix xyz . |
*[@width] | Selects all child elements of the context node that have a width attribute. |
text()[starts-with(.,‘The’)] | Selects every text node that is a child of the context node and whose text content starts with the characters The . |
*[@code][position() < 10] | Selects the first nine child elements of the context node that have a code attribute. |
*[position() < 10][@code] | Selects from the first nine child elements of the context node those that have a code attribute. |
self::*[not(@code = preceding-sibling::*/@code)] | Selects the current element node provided that it does not have a code attribute with the same value as the code attribute of any preceding sibling element. |
namespace::* | Selects all the namespace nodes that are in scope for the context node. If the context node is not an element, the result will be empty. |
self::item | Selects the context node if it is an *[not(self::item)] selects all the children of the context node except those that are effective boolean value , whereby an empty sequence is treated as false. |
comment() | Selects all comment nodes that are children of the context node. |
@comment() | Short for attribute::comment() , this selects all comment nodes on the attribute axis. The attribute axis can only contain attribute nodes, so this will always return an empty sequence; nevertheless it is a legal step. |