xpath Traversing all descendants


Example

The descendant and descendant-or-self axes can be used to find all descendant elements of a node at any depth. In contrast, the child axis only traverses immediate children.

/child::html/descendant::span
/child::html/descendant-or-self::*

The double slash // is a shortcut for /descendant-or-self::node()/. So the following expressions are equivalent:

table//td
child::table/descendant-or-self::node()/child::td
child::table/descendant::td
table/descendant::td