Skip to main content

Module xslt

Module xslt 

Source
Expand description

XSLT 1.0 transform engine.

Re-exports the public surface of sup_xml_xslt.

§Quick start

use sup_xml::{parse_str, ParseOptions};
use sup_xml::xslt::Stylesheet;

let xsl = r#"<xsl:stylesheet version="1.0"
    xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
  <xsl:template match="/"><out><xsl:value-of select="."/></out></xsl:template>
</xsl:stylesheet>"#;
let style = Stylesheet::compile_str(xsl)?;

let opts = ParseOptions { namespace_aware: true, ..Default::default() };
let doc  = parse_str("<r>hello</r>", &opts)?;
let result = style.apply(&doc)?;
println!("{}", result.to_string()?);

Modules§

schematron
Schematron — ISO/IEC 19757-3 rule-based validation. Built on top of the XSLT/XPath engine.

Structs§

Extensions
Ergonomic builder for the common case of registering a handful of closure-based extension functions keyed by (namespace, name).
FilesystemLoader
InMemoryLoader
In-memory loader keyed by href. Useful for tests and for embedding the ISO Schematron pipeline (where the skeleton stylesheets are bundled into the binary rather than loaded from disk).
NullLoader
Null loader — every load fails. Used as the default when no loader was supplied and the stylesheet doesn’t actually need resolution (i.e. has no xsl:import / xsl:include).
ResultTree
The complete result of a transformation. Carries the serialised top-level children plus the effective <xsl:output> settings the serialiser will honour.
Stylesheet
A compiled XSLT 1.0 stylesheet, ready to apply to source documents. Compilation walks the stylesheet tree once, pre-parses every XPath expression, and resolves xsl:import/xsl:include chains.

Enums§

ResultNode
One node in an in-progress result tree. Element children recurse via the children vec; attributes hang off the element separately because XPath / serialisation treat them differently from content children.
XsltError

Traits§

ExtensionFunctions
Caller-supplied lookup for non-XSLT XPath functions.
Loader
Resolve a stylesheet / document reference to its source text.