<html>
<head>
<title>XPath Node Tests</title>
</head>
<body bgcolor="#FFFFFF" text="#000000">
<div id="Description">
<table cellpadding="0" cellspacing="0" border="0" width="100%" class="main">
<tr>
<td valign="top" class="NAME" colspan="2">XPath Node Tests</td>
</tr>
<tr>
<td colspan="2" class="divider"><img src="dwres:18084" width="100%" height="1"></td>
</tr>
<tr>
<td valign="top" colspan="2" class="description">

    <p>
<!--<primary>XPath</primary>
  <secondary>node tests for</secondary>-->
<!--<primary>node tests for XPath</primary>-->

XPath defines several node tests that can be used to select nodes from the source tree. Strictly speaking, any XPath expression can be considered a node test; the expression <span class="LITERAL">para</span>, for example, selects all <span class="LITERAL">&lt;para&gt;</span> elements from the context node. Several special node tests allow you to select nodes that can't be selected any other way. (Although they look and work like functions, they are technically node tests.)  These special node tests are described here:</p>
    <dl>
<dt>
<span class="LITERAL">
text()
</span>
</dt>
<dd>
<!--<primary>text() node test</primary>-->
Selects all the text-node children of the context node.
<P></p>
<dt>
<span class="LITERAL">
comment()
</span>
</dt>
<dd>
<!--<primary>comment() node test</primary>-->
Selects all the comment-node children of the context node.
<P></p>
<dt>
<span class="LITERAL">
processing-instruction()
</span>
</dt>
<dd>
<!--<primary>processing-instruction() node test</primary>-->
Selects all the processing-instruction children of the context node. Unlike the other node tests defined here,
<span class="LITERAL">
processing-instruction()
</span>
can have an optional argument;
<span class="LITERAL">
processing-instruction('xml-stylesheet')
</span>
selects all processing instructions with a name of
<span class="LITERAL">
xml-stylesheet
</span>
.
<P></p>
<dt>
<span class="LITERAL">
node()
</span>
</dt>
<dd>
<!--<primary>node() node test</primary>-->
Is true for all nodes, regardless of type. Using this node test selects all element nodes, attribute nodes, processing-instruction nodes, etc.
<P></p>
</dl>
</td></tr>
</table>
</div>
</body>
</html>