Skip to main content

StaticContext

Trait StaticContext 

Source
pub trait StaticContext {
    // Required methods
    fn variable(&self, name: &QName) -> Option<VariableInfo>;
    fn function(&self, name: &QName, arity: usize) -> Option<FunctionId>;
    fn xslt_functions(&self) -> bool;
    fn namespace_uri(&self, prefix: &str) -> Option<String>;

    // Provided methods
    fn variable_reference(
        &self,
        name: &QName,
        in_loop: bool,
    ) -> Option<VariableInfo> { ... }
    fn function_type(&self, id: FunctionId) -> ValueType { ... }
    fn element_available(&self, name: &QName) -> Option<bool> { ... }
    fn static_base_uri(&self) -> Option<String> { ... }
}
Expand description

The static context of an expression (XPath 2.0 section 2.1.1), as far as the compiler needs it: names are already resolved by the parser.

Required Methods§

Source

fn variable(&self, name: &QName) -> Option<VariableInfo>

The variable of that expanded name in scope, if any.

Source

fn function(&self, name: &QName, arity: usize) -> Option<FunctionId>

The host function of that expanded name and arity, if any.

Source

fn xslt_functions(&self) -> bool

Whether the XSLT functions current(), document() and system-property() are available.

Source

fn namespace_uri(&self, prefix: &str) -> Option<String>

The namespace bound to a prefix, for the QName argument of system-property().

Provided Methods§

Source

fn variable_reference( &self, name: &QName, in_loop: bool, ) -> Option<VariableInfo>

The variable a reference in the expression refers to, as Self::variable: the compiler calls it once per reference, telling whether the reference is in an operand evaluated repeatedly (a predicate, a path step after the first, the body of for, some or every), as Saxon’s isLoopingReference tells it. By default, Self::variable.

Source

fn function_type(&self, id: FunctionId) -> ValueType

The static type of what a host function returns, once its call is type-checked: ValueType::declared with the declared result type of an xsl:function. By default, nothing is known.

Source

fn element_available(&self, name: &QName) -> Option<bool>

The answer of element-available() for the element of that expanded name, if known. By default, unknown (the call is refused).

Source

fn static_base_uri(&self) -> Option<String>

The static base URI of the expression, against which document() resolves the relative URIs given as strings. By default, none: the host’s.

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§