Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/blackberry/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
.net core 2019年.NET核心的XSLT3选项_.net Core_Saxon_Xslt 3.0 - Fatal编程技术网

.net core 2019年.NET核心的XSLT3选项

.net core 2019年.NET核心的XSLT3选项,.net-core,saxon,xslt-3.0,.net Core,Saxon,Xslt 3.0,2019年有人在.NETCore2.x+中使用XSLT3转换吗 似乎对MS for的请求还没有向前推进,撒克逊人还有其他优先事项,特别是考虑到 对于进程内XSLT转换,还有其他选择吗?目前,我唯一的选择似乎是通过外部服务或一些不受欢迎的(对我们来说)COM风格的方法来包装一些东西,这将涉及大量数据编组,影响性能。不幸的是,IKVM从未支持.NET Core,因此.NET版本的Saxon无法在该环境中工作。在Saxonica,我们一直在探索.NET支持的替代途径,但我们还没有发现任何有前途的东西。

2019年有人在.NETCore2.x+中使用XSLT3转换吗

似乎对MS for的请求还没有向前推进,撒克逊人还有其他优先事项,特别是考虑到


对于进程内XSLT转换,还有其他选择吗?目前,我唯一的选择似乎是通过外部服务或一些不受欢迎的(对我们来说)COM风格的方法来包装一些东西,这将涉及大量数据编组,影响性能。

不幸的是,IKVM从未支持.NET Core,因此.NET版本的Saxon无法在该环境中工作。在Saxonica,我们一直在探索.NET支持的替代途径,但我们还没有发现任何有前途的东西。(有人想为.NET实现Kotlin吗?)


我不知道使用XMLPrime或Exselt可以做什么,这两种都是针对.NET的。

有一种方法可以使用Saxon.NET内核:通过Transform.exe作为进程运行

您可以使用类似于以下内容的代码:

/// <summary>Transform XML inputFile using xsltFile and parameters. Save the result to the outputFile.</summary>

public void Transform(string inputFile, string outputFile, string xsltFile, NameValueCollection parameters)
{
//Search for the instalation path on the system
string path = GetInstalPath(@"Software\Saxonica\SaxonHE-N\Settings", "InstallPath");
string exePath = Path.Combine(path, "bin", "Transform.exe");

string parametersCmd = null;

//Set indicidual parameters
foreach (string parameter in parameters)
{
    parametersCmd += String.Format("{0}={1} ", parameter, parameters[parameter]);
}

//set arguments for Transform.exe
string arguments = string.Format("-s:\"{1}\" -xsl:\"{0}\" -o:\"{3}\" {2}", xsltFile, inputFile, parametersCmd, outputFile);

//https://stackoverflow.com/questions/5377423/hide-console-window-from-process-start-c-sharp
ProcessStartInfo startInfo = new ProcessStartInfo();
startInfo.FileName = exePath;
startInfo.Arguments = arguments;
startInfo.RedirectStandardOutput = true;
startInfo.RedirectStandardError = true;
startInfo.UseShellExecute = false;
startInfo.CreateNoWindow = true;

int waitingTime = 5 * 60 * 1000; //5 minutes; time in milliseconds

Process processTemp = new Process();
processTemp.StartInfo = startInfo;
processTemp.EnableRaisingEvents = true;

try
{
    processTemp.Start();
    processTemp.WaitForExit(waitingTime);
}
catch (Exception e)
{
    throw;
}

}

static string GetInstalPath(string comName, string key)
{
RegistryKey comKey = Registry.CurrentUser.OpenSubKey(comName);
if (comKey == null)
    return null;
string clsid = (string)comKey.GetValue(key);
return clsid;
}
///使用XSLT文件和参数转换XML输入文件。将结果保存到输出文件。
public void转换(字符串inputFile、字符串outputFile、字符串xsltFile、NameValueCollection参数)
{
//在系统上搜索安装路径
字符串路径=GetInstalPath(@“Software\Saxonica\SaxonHE-N\Settings”,“InstallPath”);
字符串exePath=Path.Combine(路径,“bin”,“Transform.exe”);
字符串参数scmd=null;
//设置指示参数
foreach(参数中的字符串参数)
{
parametersCmd+=String.Format(“{0}={1}”,parameter,parameters[parameter]);
}
//设置Transform.exe的参数
字符串参数=string.Format(“-s:\“{1}\”-xsl:\“{0}\”-o:\“{3}\”{2}”,xsltFile,inputFile,parametersCmd,outputFile);
//https://stackoverflow.com/questions/5377423/hide-console-window-from-process-start-c-sharp
ProcessStartInfo startInfo=新的ProcessStartInfo();
startInfo.FileName=exePath;
startInfo.Arguments=参数;
startInfo.RedirectStandardOutput=true;
startInfo.RedirectStandardError=true;
startInfo.UseShellExecute=false;
startInfo.CreateNoWindow=true;
int waitingTime=5*60*1000;//5分钟;时间(毫秒)
Process processTemp=新流程();
processTemp.StartInfo=StartInfo;
processTemp.EnableRaisingEvents=true;
尝试
{
processTemp.Start();
processTemp.WaitForExit(waitingTime);
}
捕获(例外e)
{
投掷;
}
}
静态字符串GetInstalPath(字符串comName,字符串键)
{
RegistryKey comKey=Registry.CurrentUser.OpenSubKey(comName);
如果(comKey==null)
返回null;
字符串clsid=(字符串)comKey.GetValue(键);
返回clsid;
}
微软似乎在2020年11月发布了.NET 5,其中包含“所有平台上的Java互操作性[…]”,因此届时可能会有一些选择将Saxon与.NET(核心/框架)5结合使用。