xslt 3.1.0

There is a newer version of this package available.
See the version list below for details.
dotnet tool install --global xslt --version 3.1.0
                    
This package contains a .NET tool you can call from the shell/command line.
dotnet new tool-manifest
                    
if you are setting up this repo
dotnet tool install --local xslt --version 3.1.0
                    
This package contains a .NET tool you can call from the shell/command line.
#tool dotnet:?package=xslt&version=3.1.0
                    
nuke :add-package xslt --version 3.1.0
                    

xslt

Command-line XSLT 3.0/4.0 processor for .NET. Transform XML documents from the terminal using the PhoenixmlDb XSLT engine.

Installation

dotnet tool install -g xslt

Usage

# Transform XML with a stylesheet
xslt stylesheet.xsl input.xml

# Write output to a file
xslt -o result.html report.xsl data.xml

# Start from a named template (no source needed)
xslt -it main generate.xsl

# Pass parameters
xslt -p year=2026 -p title="Report" style.xsl data.xml

# Read source from stdin
cat data.xml | xslt transform.xsl

# Show timing breakdown
xslt --timing style.xsl large-input.xml

# Validate a stylesheet without running
xslt --dry-run style.xsl

# Stream large files (lower memory)
xslt --stream style.xsl large-input.xml

# Validate the source against the schemas the stylesheet imports (typed nodes)
xslt --validation strict style.xsl data.xml

Features

  • XSLT 3.0/4.0 — packages, streaming, maps/arrays, higher-order functions, JSON output
  • Multiple output methods — XML, HTML, XHTML, text, JSON, adaptive
  • Streaming — process large files without loading into memory
  • xsl:result-document — generate multiple output files in one transform
  • Parameters — pass values from the command line
  • Timing — built-in performance profiling
  • Tracing — log template matching, function calls, and built-in rules

Documentation

Full documentation at phoenixml.dev

License

Apache-2.0

Product Compatible and additional computed target framework versions.
.NET net10.0 is compatible.  net10.0-android was computed.  net10.0-browser was computed.  net10.0-ios was computed.  net10.0-maccatalyst was computed.  net10.0-macos was computed.  net10.0-tvos was computed.  net10.0-windows was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

This package has no dependencies.

Version Downloads Last Updated
3.2.0 66 11/18/2026
3.1.0 102 11/13/2026
3.0.0 99 11/4/2026
2.9.0 237 10/15/2026
2.8.0 97 10/9/2026
2.7.0 89 10/7/2026
2.6.0 107 10/6/2026
2.5.1 101 10/1/2026
2.4.1 118 9/28/2026
2.4.0 88 9/28/2026
2.2.0 870 9/25/2026
2.1.0 94 9/17/2026
2.0.0 97 9/15/2026
1.8.0 110 9/14/2026 1.8.0 is deprecated because it has critical bugs.
1.7.0 112 9/11/2026 1.7.0 is deprecated because it has critical bugs.
1.6.15 143 9/9/2026 1.6.15 is deprecated because it has critical bugs.
1.6.14 162 9/7/2026 1.6.14 is deprecated because it has critical bugs.
1.6.13 130 9/2/2026 1.6.13 is deprecated because it has critical bugs.
1.6.12 120 8/30/2026 1.6.12 is deprecated because it has critical bugs.
1.6.11 114 8/29/2026 1.6.11 is deprecated because it has critical bugs.
Loading failed

Requires PhoenixmlDb.XQuery 3.1.0 and PhoenixmlDb.Core 2.6.0. A limit on the length of built
strings, and streaming that holds memory flat for more stylesheets. W3C XSLT: 131 failing of
11,539, measured on a host in UTC (3.0.0: 132).

### New: a limit on the length of a built string

`XsltTransformOptions.MaxStringLength` and `XsltTransformer.MaxStringLength` (`int?`, default
`null`: no limit) set the longest string, in UTF-16 code units, that one operation may build. Over
the limit is `FOER0000`.

- XPath expressions apply it through `QueryExecutionLimits.MaxStringLength`: `concat`,
 `string-join`, `||` and the other string builders.
- XSLT instructions that join values into one string apply it too: `xsl:value-of`, the content of
 `xsl:attribute`, `xsl:comment`, `xsl:processing-instruction` and `xsl:namespace`, and attribute
 and text value templates.
- `fn:transform` passes the limit to the transformation it starts, in both directions.

`MaxOutputSize` limits only the serialized result. A stylesheet, or a Schematron schema compiled to
one, can build a very large string from no input, faster than a time limit can cancel it. A host
that runs untrusted stylesheets sets both limits.

### New: `XsltTransformer.LastTransformStreamed`

A streamable stylesheet does not always stream: an entry at a named template or a function, and a
rule for the document node that the streaming pass cannot answer, read the input whole. The
read-only property tells whether the last transformation streamed. The `--timing` label of the
CLI comes from it.

### Streaming

- **The `TextReader` overloads stream** (#464): with a streamable initial mode, they read from the
 reader as the `Stream` overloads do. The CLI writes standard output as the result is produced:
 `sum(root/item)` over 4 million items uses 100 MiB (3.0.0: 331 MiB).
- **A streamed `xsl:source-document` with `use-accumulators="#all"` runs the accumulators.** In
 3.0.0 the values on streamed elements were those of an empty tree, with no error.
- **`accumulator-after()` of the document node streams** (#461): after `xsl:apply-templates`, and
 as the only read of the input. 3.0.0 read the input into a tree, about 1 GiB per million items.
- **A leading `/` in a rule for the document node is that node** (#468): in a `match="/"` rule,
 `sum(/root/item)`, `sum(//item)` and `count(/root/item)` stream, about 100 MiB per million items
 (3.0.0: about 800 MiB).
- **An aggregate over a value computed from each element streams** (#462).
- **With a caller's writer** (#472): `method="json"` output reaches the writer, and a source with
 strict or lax validation is read whole and validated as a tree.

### Other behaviour

- **`fn:function-lookup` inside `xsl:evaluate` raises XTDE3160 for the XSLT-defined functions**, as
 a direct call does (XSLT 3.0 §10.4.1; W3C evaluate-048). A `function-lookup#2` item made in the
 stylesheet keeps the stylesheet's context.
- A failure deep in recursion returns quickly.
- The remarks of `TransformAsync` say that completing its task needs a free thread-pool thread.

### Repository

No package change: the conformance run measures the XSLT suite only (QT3 is measured in
phoenixmldb-xquery), and the tests wait with `Task.WaitAsync` (CA2027).