XML Tutorial/XPath/descendant or self
The descendant-or-self axis includes all the nodes in the descendant axis plus the context node (which is contained in the self axis).
<source lang="xml">
The abbreviated form for the descendant-or-self axis is //. This enables you to find nodes irrespective of their position. File: Data.xml <?xml version="1.0" encoding="utf-8"?>
<AAA id="a1" pos="start"> <BBB id="b1"/> <BBB id="b2"/> </AAA> <AAA id="a2"> <BBB id="b3"/> <BBB id="b4"/> <CCC id="c1"> <CCC id="c2"/> </CCC> <BBB id="b5"> <CCC id="c3"/> </BBB> </AAA>
File: Transform.xslt <?xml version="1.0" encoding="utf-8"?> <xsl:stylesheet
version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"> <xsl:template match="/">
Axis: descendant-or-self | |
---|---|
Element</th>
<td>Node-set</th> |
Axis: descendant-or-self | |
---|---|
Element</th><td>Node-set</th> |