Module xrust::transform::context

source ·
Expand description

Context for a transformation

A dynamic and static context for a transformation. These are both necessary to give the transformation all the data it needs to performs its functions.

The dynamic Context stores data that changes. It is frequently cloned to create a new context. A ContextBuilder can be used to create the dynamic context incrementally.

The StaticContext stores immutable data and is not cloneable. A StaticContextBuilder can be used to create the static context incrementally.

A Context is used to evaluate a Transform. The evaluate method matches the current item to a template and then evaluates the body of that template. The dispatch method directly evaluates a given Transform.

Structs

  • The transformation context. This is the dynamic context. The static parts of the context are in a separate structure. Contexts are immutable, but frequently are cloned to provide a new context. Although it is optional, it would be very unusual not to set a result document in a context since nodes cannot be created in the result without one.
  • Builder for a Context
  • The static context. This is not clonable, since it includes the storage of a closure. The main feature of the static context is the ability to set up a callback for messages. See StaticContextBuilder for details.
  • Builder for a StaticContext. The main feature of the static context is the ability to set up a callback for messages.