用于 .NET 的 XPath 和 XSLT 2.0?
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/1525299/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
XPath and XSLT 2.0 for .NET?
提问by Wim ten Brink
.NET 3.5 doesn't completely support XPATH 2.0 or XSLT 2.0, which is just too bad. Does anyone know if these two will be included and fully supportedin any future .NET versions?
.NET 3.5 不完全支持 XPATH 2.0 或 XSLT 2.0,这太糟糕了。有谁知道这两个是否会在任何未来的 .NET 版本中包含并完全支持?
回答by Max Toro
I don't think they'll add support for XPath 2.0 or XSLT 2.0 any time soon.
我认为他们不会很快添加对 XPath 2.0 或 XSLT 2.0 的支持。
However, you shouldn't feel bad if these are not part of the BCL, as long as you have 3rd party implementations available:
但是,如果这些不是 BCL 的一部分,您应该不会感到难过,只要您有 3rd 方实现可用:
- Saxon: XPath 3.1, XQuery 3.1, XSLT 3.0
- XmlPrime: XPath 3.1, XQuery 3.1, XSLT 2.0
- QueryMachine: XPath 2.0, XQuery 1.0
- Lightweight XPath2 for .NET: XPath 2.0
- Exselt: XSLT 3.0
- 撒克逊:XPath 3.1、XQuery 3.1、XSLT 3.0
- XmlPrime:XPath 3.1、XQuery 3.1、XSLT 2.0
- 查询机:XPath 2.0、XQuery 1.0
- .NET 的轻量级 XPath2:XPath 2.0
- 导出:XSLT 3.0
Microsoft is customer oriented. If customers don't want it, they won't make it.
微软以客户为导向。如果客户不想要它,他们就不会成功。
2009-11-18: I contacted the XML team hereand got this response:
2009-11-18:我在这里联系了 XML 团队 并得到了这样的回复:
While XML continues to be a key part of our platform going forward, we have decided not to pursue an XSLT 2.0 implementation at this time. If there is a specific XSLT task you're trying to accomplish and are having difficulty with XSLT 1.0, please let us know and we'll do our best to help.
虽然 XML 继续是我们平台未来的关键部分,但我们决定此时不追求 XSLT 2.0 实现。如果您正在尝试完成特定的 XSLT 任务并且在使用 XSLT 1.0 时遇到困难,请告诉我们,我们将尽力提供帮助。
This list is now maintained at github.com/maxtoroq/dotnet-xml
此列表现在维护在github.com/maxtoroq/dotnet-xml
回答by David Basarab
See this blog post
看这篇博文
There are several reasons why we aren't implementing XSLT 2.0 and XPath 2.0
It takes a lot of effort and resources to implement all 3 technologies (XQuery, XSLT 2.0 & XPath 2.0). Our guiding principle was that we believe creating a proliferation of XML query technologies is confusing to end users. We'd rather implement one more language that we push people to learn than have to support and explain three more XML query and transformation languages, in addition to XPath 1.0 & XSLT 1.0 which already exist in the .NET Framework. Having our customers and support people have to deal with the complexity of 3 sophisticated XML query languages two of which are look similar but behave quite differently in the case of XPath 2.0 and XQuery seemed to us not to be that beneficial.
我们没有实现 XSLT 2.0 和 XPath 2.0 的原因有很多
实现所有 3 种技术(XQuery、XSLT 2.0 和 XPath 2.0)需要大量的精力和资源。我们的指导原则是我们相信创建大量的 XML 查询技术会让最终用户感到困惑。除了 .NET Framework 中已经存在的 XPath 1.0 和 XSLT 1.0 之外,我们宁愿多实现一种我们推动人们学习的语言,也不愿支持和解释另外三种 XML 查询和转换语言。让我们的客户和支持人员必须处理 3 种复杂的 XML 查询语言的复杂性,其中两种看起来相似但在 XPath 2.0 的情况下表现非常不同,而 XQuery 在我们看来并不是那么有益。
回答by pgfearo
My understanding is that many Microsoft XML resources were diverted from XSLT 2.0 onto LINQ to XML, which - in my view - doesn't address the same problem-space as XSLT at all.
我的理解是,许多 Microsoft XML 资源从 XSLT 2.0 转移到 LINQ to XML,在我看来,这根本无法解决与 XSLT 相同的问题空间。
LINQ to XSD was supposed to enhance LINQ to XML (as well as XML Schema benefits, the syntax is less ugly), but this was open-sourced by Microsoft onto CodePlex some time ago and appears to have no community support.
LINQ to XSD 本来是为了增强 LINQ to XML(还有 XML Schema 的好处,语法不那么难看),但这是微软前段时间在 CodePlex 上开源的,似乎没有社区支持。
Also, its unlikely that Microsoft would launch a new XSLT 2.0 processor without an XSLT 2.0 editor and debugger integrated into Visual Studio, so quite a bit of effort/time would be required to reverse their 'non-adoption' decision.
此外,微软不太可能在没有 XSLT 2.0 编辑器和调试器集成到 Visual Studio 的情况下推出新的 XSLT 2.0 处理器,因此需要相当多的努力/时间来扭转他们的“不采用”决定。
So instead we have Saxon.NET, which has an unimpeachable standards compliance reputation and provides excellent extensibility options for .NET.
因此,我们拥有 Saxon.NET,它拥有无可挑剔的标准合规性声誉,并为 .NET 提供出色的可扩展性选项。
回答by Oliver Hallam
Microsoft have no plans to release support for XPath/XSLT 2.0 in .NET.
Microsoft 没有计划在 .NET 中发布对 XPath/XSLT 2.0 的支持。
XQSharpprovides a 3rd party implementation of XPath 2.0, XSLT 2.0 and XQuery for .NET.
XQSharp提供 XPath 2.0、XSLT 2.0 和 XQuery for .NET 的第 3 方实现。
[edit: XQSharp 2.0 beta (with XSLT 2.0) has been released]
[编辑:XQSharp 2.0 beta(带有 XSLT 2.0)已经发布]
回答by Brian Agnew
I can't believe they won't be at some stage since they're core W3C technologies. However I can't find any currentreference to these (only info posted a long time ago).
我不敢相信它们不会在某个阶段出现,因为它们是 W3C 的核心技术。但是我找不到对这些的任何当前参考(只有很久以前发布的信息)。
For the near future you should take a look at Saxonwhich supports the Xpath/XSLT versions you require.
在不久的将来,您应该看看支持您需要的 Xpath/XSLT 版本的Saxon。

