Tamino XML Server Version 9.7
 —  X-Query Reference Guide  —

NodeTest

Check if a node satisfies conditions on the type or name of a node.


Syntax

NodeTest

graphics/NodeTest.jpg

Top of page

Description

A NodeTest defines type or name of a node in a NodeTest. It can be a NameTest, a node type as defined in NodeType or a processing instruction which optionally can have a name that conforms to the definition of a Literal.

A NameTest is either a name or a wildcard expression matching a set of names. If NameTest is "*", it matches any name, otherwise it matches a given name.

Using NodeType(), you can select nodes of the specified type ("comment", "node", or "text") on the relevant axis. As a further type of node, you can select processing instruction nodes (represented as <?PITarget?>) which may or may not have a Literal. A Literal is a sequence of characters that is enclosed either in double quotes (then it must not contain a double quote) or in single quotes (then it must not contain a single quote).

Note:
Only processing instruction nodes (PIs) that are nested inside the root node element can be selected. Any PIs outside are not accounted for, such as the XML declaration that looks like a PI and declares a document to be an XML document (<?xml version="1.0"?>).

Top of page

Compatibility

It corresponds to the expression NodeTest defined in XPath, Section 2.3, Rule 7 with the exception that in X-Query it formally also subsumes the definition of an unnamed processing instruction which in XPath is included in the definition of NodeType instead. However, this difference is of no practical relevance.

NameTest and Literal correspond to the respective XPath expressions, as defined in the Section 3.7, Rules 37 and 29.

Top of page

Examples

Top of page

Related Expression

NodeType Step

Top of page