Some options besides SaxonCS to run XSLT 3, XQuery 3.1, XPath 3.1 under .NET Core aka .NET 6 or 7

February 26, 2023

Submitted by Martin Honnen.

So far Saxonica, one of the two major vendors of libaries and tools to use and run the current versions of XSLT 3.0 and/or XQuery 3.1 and/or XPath 3.1, has produced its SaxonCS product for .NET Core aka .NET 6 or 7 only as the commercial enterprise EE SaxonCS version.

For those wanting to use XSLT 3.0 and/or XQuery 3.1 and/or XPath 3.1 with .NET 6 or 7 aka .NET Core now, without relying on the commercial, enterprise edition of SaxonCS, I have managed to use the latest IKVM version to cross-compile both Saxon HE 10 Java as well as Saxon HE 11 Java to .NET.

I have published a couple of NuGet packages to allow that; for Saxon HE 10 (now at release 10.9) there are the two library packages

that allow you to use Saxon HE 10 (now 10.9) in .NET Core (3.1 and later e.g. 5, 6, 7) code pretty much the same way you could use Saxon .NET 10.9 HE with .NET framework, by adding the packages to your project and using the documented using Saxon.Api; API.

Additionally I have created two dotnet command line tools to run XSLT 3.0 or XQuery 3.1 with Saxon HE 10 from the command line:

These are similar to the Transform.exe or Query.exe of the existing Saxon HE .NET 10 framework product of Saxonica, only repackaged/republished as a .NET/dotnet command line tool you can directly install (with an existing .NET SDK installed) using e.g. dotnet tool install --global SaxonHE10Net31Xslt --version 10.9.0.


For Saxon HE 11 Java I have also been succesful to use IKVM to cross-compile it to .NET (Core), however, as Saxon 11 has been discontinued on .NET other than so far producing the closed source, commercial SaxonCS, the .NET API source code of Saxon 10 in the form of Saxon.Api is not directly compatible with Saxon HE 11; my attempts to rewrite/adapt it failed both due to my lack of knowledge the lower levels of Saxon's code base and some problems of the existing IKVM toolkit to recompile Java and .NET code. That means you can use Saxon HE 11 with .NET Core aka .NET 6 or 7 but not with the previous Saxon.Api API; instead, you would directly use the underlying Java s9api API or can make use of my extension method library package https://www.nuget.org/packages/SaxonHE11s9apiExtensions/ that provides various convenience extension methods to better interface between .NET FileInfo or String and the s9api Java APIs.

Additionally, I have also produced four dotnet command line tools using Saxon HE 11 (now at version 11.5), one for pure XSLT 3.0, one for XSLT 3.0 with additional support for Invisible XML, one for pure XQuery 3.1 and the last one for XQuery 3.1 with support for Invisible XML:

The iXML/Invisible XML support is possible thanks to also IKVM cross-compiling Norm Walsh's various nineml/coffeeX libaries to .NET.

Please understand that none of the packages is in any way a tested or supported or approved product of Saxonica, these are the results of my own experiments to use the latest .NET Core compatible IKVM releases and the supporting IKVM.Maven.Sdk package to cross-compile the Maven packages of Saxon HE 10 or 11 Java to .NET (and add the Saxon.Api .NET API for Saxon 10 or my extension method package for HE 11).

As Saxon HE is released under the Mozilla Public License 2.0, of course all the packages are using the same license.

To demonstrate the use of these packages in .NET Core code I have also adapted the Saxon samples accompanying to various Saxon releases to use my packages and created some GitHub repositories for that:



News items may be commercial in nature and are published as received.