Skip to content

feat(xslt): implement complete XSLT 1.0 engine #141

Description

@polaz

Problem

Full libxmlsec1 compatibility requires XSLT 1.0 semantics, but the project cannot depend on libxslt at runtime and the evaluated Rust engines do not provide the required XSLT 1.0 value model and compatibility behavior. A partial identity-transform implementation would still produce incorrect reference digests for real stylesheets.

Implementation

  • Add a dedicated safe-Rust workspace crate for a reusable XSLT 1.0 compiler and runtime with no XMLDSig, XMLEnc, crypto, or parser-specific public types.
  • Implement the XPath 1.0 four-type value model and dynamic/static contexts used by XSLT, preserving result-tree fragments as a distinct type.
  • Compile immutable stylesheets with template matching, priority and import precedence, modes, named templates, variables and parameters, built-in rules, whitespace rules, keys, decimal formats, namespace aliases, and output declarations.
  • Execute apply/call-template, iteration and sorting, conditionals, copying, computed nodes, numbering, messages, and result-tree construction with shared deterministic budgets.
  • Serialize XML, HTML, and text results with declarations, encodings, indentation, and disable-output-escaping behavior compatible with the pinned libxslt oracle.
  • Keep all resource resolution and extension behavior behind explicit generic caller contracts with no implicit filesystem, network, environment, or global-registry access.
  • Update direct dependencies to their current releases and adapt affected call sites.

Acceptance criteria

  • The engine crate can be built, tested, documented, and later published independently of the XML Security crate.
  • Public contracts expose generic owned/source-backed XML identities only; no roxmltree, xmloxide, libxml2, XMLDSig, or XMLEnc types cross the boundary.
  • Every required XSLT 1.0 instruction and declaration has focused positive, negative, and boundary coverage.
  • XPath conversions, template conflict resolution, result-tree fragments, namespace fixup, whitespace handling, keys, numbering, sorting, and serialization match normative XSLT 1.0 behavior and classified libxslt behavior.
  • Compiled stylesheets are immutable and safe to share across threads.
  • Budget exhaustion, malformed stylesheets, missing templates, resolver failures, cycles, serialization failures, and unsupported extensions return typed deterministic errors without partial success.
  • Workspace checks, all-feature and minimal-feature builds, clippy, unit/integration tests, and doctests pass.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions