<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<link rel="stylesheet" type="text/css" href="CSS/tutorial.css">
<title>XPath Tutorial</title>
<link rel="index" href="index.html">
<link rel="previous" href="example20.html">
<link rel="next" href="example22.html">
</head>
<body>
<table xmlns="http://www.w3.org/1999/xhtml" width="100%">
<tr>
<td><span class="mediumText"><a class="naviBlack" target="_self" href="../Output/example21.html">English</a> | <a class="naviBlack" target="_self" href="../Output_cze/example21.html">česky</a> | <a class="naviBlack" target="_self" href="../Output_dut/example21.html">Nederlands</a> | <a class="naviBlack" target="_self" href="../Output_fre/example21.html">Français</a> | <a class="naviBlack" target="_self" href="../Output_spa/example21.html">Español</a> | <a class="naviBlack" target="_self" href="../Output_rus/example21.html">По-русски</a> | <a class="naviBlack" target="_self" href="../Output_ger/example21.html">Deutsch</a> | <b>>> 中文 <<</b> | <a class="naviBlack" target="_self" href="../Output_ita/example21.html">Italiano</a> | <a class="naviBlack" target="_self" href="../Output_pol/example21.html">Polski</a></span></td>
<td style="text-align:right"><span class="mediumText"><a class="naviBlack" target="_top" href="http://www.zvon.org">ZVON</a>
>
<a class="naviBlack" target="_top" href="http://www.zvon.org/index.php?nav_id=tutorials">Tutorials</a>
>
<b>XPath Tutorial</b></span></td>
</tr>
</table>
<table xmlns="http://www.w3.org/1999/xhtml" class="bar" width="750px" border="0" cellpadding="0" cellspacing="0">
<tr>
<td class="naviBlue"><a class="naviWhite" target="_top" href="../General_chi/examples.html">介绍</a>
/
<a class="naviWhite" target="_top" href="http://zvon.org/search.php">搜索</a>
/
<a class="naviWhite" target="_top" href="http://www.zvon.org"> ZVON </a></td>
</tr>
</table>
<table class="hangingMenu" border="0" cellpadding="1" cellspacing="0" width="100%">
<tr>
<td><b>>> 实例 21 <<</b>
|
<a class="naviBlack" href="example20.html">前页</a>
|
<a class="naviBlack" href="example22.html">后页</a></td>
</tr>
</table><br><div class="description">ancestor, descendant, following, preceding 和self轴(axis)分割了XML文档(忽略属性节点和命名空间节点), 不能交迭, 而一起使用则包含所有节点</div>
<div><a name="b9b1c27c35"></a>
</div>
<table border="1" cellpadding="5" width="85%">
<tr>
<th>//GGG/ancestor::*</th>
</tr>
<tr>
<td></td>
</tr>
<tr>
<td class="code">
<br> <<span class="elementOn">AAA</span>>
<br> <<span class="element">BBB</span>>
<br> <<span class="element">CCC</span>/>
<br> <<span class="element">ZZZ</span>/>
<br> </<span class="element">BBB</span>>
<br> <<span class="elementOn">XXX</span>>
<br> <<span class="elementOn">DDD</span>>
<br> <<span class="element">EEE</span>/>
<br> <<span class="elementOn">FFF</span>>
<br> <<span class="element">HHH</span>/>
<br> <<span class="element">GGG</span>>
<br> <<span class="element">JJJ</span>>
<br> <<span class="element">QQQ</span>/>
<br> </<span class="element">JJJ</span>>
<br> <<span class="element">JJJ</span>/>
<br> </<span class="element">GGG</span>>
<br> <<span class="element">HHH</span>/>
<br> </<span class="elementOn">FFF</span>>
<br> </<span class="elementOn">DDD</span>>
<br> </<span class="elementOn">XXX</span>>
<br> <<span class="element">CCC</span>>
<br> <<span class="element">DDD</span>/>
<br> </<span class="element">CCC</span>>
<br> </<span class="elementOn">AAA</span>>
</td>
</tr>
<tr>
<td><a target="_top" href="http://www.zvon.org:9001/saxon/cgi-bin/XLab/XML/xpatut_21.html?stylesheetFile=XSLT/xpath.xslt&value=//GGG/ancestor::*">在XLab中打开实例</a> | <a href="example21_0_png.html">树视图 (JPG)</a></td>
</tr>
</table>
<div><a name="b9b1c27c37"></a>
</div>
<table border="1" cellpadding="5" width="85%">
<tr>
<th>//GGG/descendant::*</th>
</tr>
<tr>
<td></td>
</tr>
<tr>
<td class="code">
<br> <<span class="element">AAA</span>>
<br> &nb