
[1] 【[[XPath]]】 [[軸]] 
[CODE(XPath)[descendant-or-self]]
は、その[[節]]及びその[[子孫節]]をあらわしまず。
この軸は[[順軸]]です。

* 省略形 //

[2] [CODE(XPath)[/descendant-or-self::[[node]]()/]]
は、略して [CODE(XPath)[//]] と書くことが出来ます。
<http://www.w3.org/TR/xpath#path-abbrev>

[3] 例えば、 [CODE(XPath)[//[[child]]:p]]
は、 [CODE(XPath)[/descendant-or-self::node()/child:p]]
です。[[文脈節]]からみて、
[CODE[文脈節自身か、その子孫節である [CODE(XML)[p]] 要素]]が選択されます。

[PRE[
<root>
  <p id="p1">
    <foo>
      <p id="p2"/>
    </foo>
  </p>
  <p id="p3"/>
  <bar><p id="p4"/></bar>
  <p id="p5"/>
</root>
]PRE]

この例では、要素 [CODE(XML)[p1]]〜[CODE(XML)[p5]]
がこの順に結果[[節集合]]に入ります。

[4] 仕様書にもありますが、 [SAMP(XPath)[//child:p]] は
[SAMP(XPath)[/descendant:p]] の省略''ではない''のに注意が必要です。
この違いは[[述部]]を使って濾過する時に重要になります。

[SAMP(XPath)[//child:p[2] ]]
は [CODE(math)[{[CODE(XML)[p3]]}]]
が、 [SAMP(XPath)[/descendant:p[2] ]]
は [CODE(Math)[{[CODE(XML)[p2]]}]]
が結果になります。
- [5] [[XSLT]] の[[パターン]]では、 [CODE(XPath)[descendant-or-self]] が使えないくせに [CODE(XPath)[//]] が使えたりします。