pub struct StaticContext {
pub xpath_2_0: bool,
pub xpath_3_0: bool,
pub libxml2_compatible: bool,
pub current_node: Option<NodeId>,
}Expand description
The static evaluation context (XPath 2.0 §2.1.1) — the config that
is fixed for the whole evaluation and travels by reference so it
can’t be lost or duplicated. Holds exactly the knobs that don’t
vary within an evaluation; genuinely dynamic state (context item,
position, the [xsl:]default-collation that nests via
Expr::WithDefaultCollation) lives elsewhere.
Carried on EvalCtx; a nested context (for body, predicate)
copies the same &StaticContext, so a value set once at the top is
seen everywhere — unlike the old per-method XPathBindings config,
which a binding wrapper could silently reset to its default.
Fields§
§xpath_2_0: boolXPath 2.0+ host — selects xs:integer/decimal literal typing and the F&O scientific double→string form.
xpath_3_0: boolXPath 3.0+ host — gates 3.0-only function signatures (e.g. the
2-argument fn:round($arg, $precision) form) that are a static
error in a 2.0 context.
libxml2_compatible: boollibxml2-compat mode — where the spec and libxml2 historically
diverge (number('-'), large-magnitude number formatting, …).
current_node: Option<NodeId>The node the XSLT current() function returns: the context node
of the whole top-level expression, fixed for the evaluation.
Unlike EvalCtx::context_node it does NOT change as evaluation
descends into location steps and predicates — so current()
inside a nested predicate (foo[@x=current()/@y], as ISO
Schematron’s phase selection uses) resolves to the instruction’s
current node rather than the predicate’s context.
None means “no fixed current node was threaded” — current()
then falls back to the live context node (the historical
behaviour, correct outside nested predicates). Hosts that know
the instruction’s current node (the libxml2 ABI shim) set Some.
Implementations§
Trait Implementations§
Source§impl Clone for StaticContext
impl Clone for StaticContext
Source§fn clone(&self) -> StaticContext
fn clone(&self) -> StaticContext
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more