pub enum NodeTest {
AnyNode,
Text,
Comment,
PI(Option<String>),
Document(Option<Box<NodeTest>>),
Wildcard,
PrefixWildcard(String),
LocalNameOnly(String),
LocalName(String),
QName(String, String),
DefaultNamespaceName {
uri: String,
local: String,
},
}Variants§
AnyNode
node() — any node on the axis
Text
text()
Comment
comment()
PI(Option<String>)
processing-instruction() or processing-instruction(‘target’)
Document(Option<Box<NodeTest>>)
document-node() — matches document nodes (XPath 2.0 §2.5.4).
Distinct from AnyNode so XSLT match="document-node()"
patterns don’t accidentally cover element / text / etc.
The optional inner test carries the element name test of a
document-node(element(N)) / document-node(element(*)) form
(XPath 2.0 §2.5.4.3): the node matches only when it is a
document node whose document element satisfies that test.
None is the bare document-node().
Wildcard
- — any element/attribute
PrefixWildcard(String)
prefix:* — any element/attribute in this namespace prefix
LocalNameOnly(String)
*:localname — any namespace, specific local name (XPath 2.0
§2.5.5.3 — WildcardName ::= NCName ":" "*" | "*" ":" NCName).
LocalName(String)
localname (no prefix)
QName(String, String)
prefix:localname
DefaultNamespaceName
Unprefixed name that resolves through the XSLT 2.0
xpath-default-namespace attribute (XSLT 2.0 §5.1.1).
The XPath parser produces LocalName; the XSLT compiler
rewrites those into this variant when an ancestor of the
stylesheet element declares a non-empty default URI for
element name tests. Stored as expanded URI + local part so
runtime matching is a pair-compare without binding lookup.