Skip to main content

StaticContext

Struct StaticContext 

Source
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: bool

XPath 2.0+ host — selects xs:integer/decimal literal typing and the F&O scientific double→string form.

§xpath_3_0: bool

XPath 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: bool

libxml2-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§

Source§

impl StaticContext

Source

pub fn num_style(&self) -> NumStyle

Number-serialization style implied by the static context.

Trait Implementations§

Source§

impl Clone for StaticContext

Source§

fn clone(&self) -> StaticContext

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Copy for StaticContext

Source§

impl Debug for StaticContext

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Default for StaticContext

Source§

fn default() -> Self

Strict XPath 1.0 — the conservative default for a bare context.

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.