Navigating Along the descendant Axis

MSXML 5.0 SDK

Microsoft XML Core Services (MSXML) 5.0 for Microsoft Office - XPath Developer's Guide

Navigating Along the descendant Axis

The descendant:: axis of a given context node locates all element nodes which the context node contains, that is, all children, all the children's children, and so on. The location step:

/descendant::*

locates all elements descended from the root node, and therefore locates all elements in a given document.

Since the descendant:: axis extends the child:: axis recursively through the context node's tree, the same restrictions apply as for the child:: axis. In particular, using a name node test, specific element names or the * for all elements, do not select comments and PIs descended from the context node. If you need to select comments and PIs as well as elements, use:

descendant::node()

attributes and namespaces can never be located on the child:: axis, and therefore cannot be located on the descendant:: axis.

See Also

Sample XML File for Navigating XPath Axes | Navigating Along the child Axis