问题
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.
回答1:
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.
来源:https://stackoverflow.com/questions/58926380/are-there-any-xslt-and-xquery-processors-available-for-net-core-3-0-apps