Selects values.
A single selection reaches across the whole target set: the values retrieved from each target are merged into one list, sparing the caller a loop of its own. Every axis, node test, predicate, operator and core function XPath 1.0 defines is available, each target taken in its turn as the context node.
An expression computing a string, a number or a boolean, count(//item) among them, reports the value it
computed for each target, so that whatever the language can express is reached the same way. A value an
expression computed holds no tree of its own, and so selects nothing in its turn.
Names are matched as the tree holds them, case sensitively, prefixes compared as written and no xmlns
declaration read, so that a single set of expressions serves both the XML trees and the HTML ones, whose names
are folded to lower case as they are parsed:
item addresses <item> however the document
declares a default namespace, and leaves <d:item> outd:b addresses <d:b> whatever URI the document binds
d to, and nothing at all where the same element is written under another prefixlocal-name() reports a name without its prefix and name() reports it whole, so <d:b> answers to
local-name()='b' and to name()='d:b' alikenamespace-uri() reports the prefix a name carries rather than the URI a declaration binds it to, as no
declaration is read; the xml prefix is the exception, bound by definition, so @xml:base and lang() read
what they are meant toxmlns declarations themselves are ordinary attributes, reported by an attribute step like any otherThe XML declaration and the document type declaration are not nodes, as the language prescribes, and a processing
instruction is not one either, so processing-instruction() selects nothing; namespace:: selects nothing in
its turn, as no namespace node is held. A CDATA section is a text node holding what it wraps, rather than a
node of its own.
The selection expression
An immutable list of the values selected by path, ordered by target and, within each target, in
document order, each node reported once; empty if path selects no value
SyntaxError If path is malformed
XPath selector over parsed X/HTML trees.
Selects the values held by a fixed set of Target nodes, addressing them with XPath 1.0 expressions. The target set is settled when the selector is created and cannot be changed afterwards.