nam
nam

Reputation: 23749

Are there any XSLT and XQuery Processors available for .NET Core 3.0 apps?

I've been using Saxon XSLT and XQuery processor - Free home edition for some of my .NET apps. I need only XSLT 2.0 (since .NET does not support XSLT 3.0). Now that I've moved from .NET Framework to .NET Core, I noticed that the Saxon has not yet supported .NET Core since when installing a Nuget package for Saxon, I get the following error.

Question: Are there other alternatives that someone knows I can use for my .NET Core projects that need XSLT 2.0 and XQuery processing?

Because of the following error my code does not compile since it does not recognize XdmNode, XsltTransformer, etc.

Package 'Saxon-HE 9.9.1.5' was restored using '.NETFramework,Version=v4.6.1, .NETFramework,Version=v4.6.2, .NETFramework,Version=v4.7, .NETFramework,Version=v4.7.1, .NETFramework,Version=v4.7.2, .NETFramework,Version=v4.8' instead of the project target framework '.NETCoreApp,Version=v3.0'. This package may not be fully compatible with your project.

Upvotes: 1

Views: 1810

Answers (1)

Martin Honnen
Martin Honnen

Reputation: 167436

XmlPrime https://www.xmlprime.com/xmlprime/ is a pure .NET implementation of XQuery 3.1 and XSLT 2.0, it was developed for the .NET framework and the latest version 4 also to work with Mono.

I have installed the current trial version of 4.1 and have written a .NET Core 3 console application with VS 2019 where I have added the two assemblies XmlPrime.dll and XmlPrime.ExtensionMethods.dll of the XmlPrime installation directory as references to the .NET core project.

Two simple examples adapted from https://github.com/XmlPrime/Examples/tree/master/Query and https://github.com/XmlPrime/Examples/tree/master/Transform then run fine to execute XQuery 3 and XSLT 2 in the .NET Core 3 app.

So technically XmlPrime, at least with some superficial tests, seems an option for .NET Core 3, I don't know about the state of their project however, as far as I know they only occasionally update their trial version and have stopped to sell commercial licenses online. You might need to enquire at the contact details of https://www.xmlprime.com/xmlprime/contact.htm to ask whether they sell full licenses some other way.

In 2022 Saxonica released SaxonCS 11 (https://www.saxonica.com/download/dotnet.xml), its first release of a pure .NET 5 Core implementation of XSLT 3.0, XQuery 3.0, XPath 3.1 (and XSD 1.0 and 1.1 schema validation). The current stable release is 11.5 and runs on .NET 6 and 7.

Furthermore SaxonCS 12 (https://www.saxonica.com/download/dotnet.xml) for .NET 6 and 7 has been released in 2023.

For non-commercial options, I have managed to cross-compile both Saxon HE 10.8 as well as Saxon HE 11.5 Java with the IKVM revived tools to .NET core, find packages and samples on NuGet and Github:

Upvotes: 2

Related Questions