LINQ to xml与XQuery或XSLT [英] LINQ to xml vs XQuery or XSLT

查看:75
本文介绍了LINQ to xml与XQuery或XSLT的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

从长远来看,我想知道LINQ to XML是否将取代XQuery或XSLT.

I want to know whether LINQ to XML is going to replace XQuery or XSLT in the long run. Which is a better technology?

推荐答案

LINQ是一种语言功能,其中XSLT是定义另一个文档转换的文档.
使用LINQ,您可以根据数据集之外的参数选择数据.例如,用户可以从组合框中选择Sum,Min,Max之类的函数,并在LINQ语句中使用它来产生答案.

对于XSLT,这是不同的,因为XSLT不会更改.如果您希望XSLT生成Sum,则已经在XSLT中对其进行了定义,并且可以始终执行,也可以基于XML的信息来执行. XSLT将始终根据给定的XML生成一个新文档.

两者的用法可能有一些相似之处,但有很大不同. LINQ在应用程序中提供了灵活性,但是XSLT非常适合在应用程序外部以预定义的方式转换数据(因此,如果需要的话可以方便地进行更新).使用XSLT,您可以轻松地将XML转换为HTML.它们提供了bot强大的功能,但是会并且不能互相替代.

好吧,希望这能使您对此有所了解.还有许多不同点和相似点,但重要的是要记住,不可能说一种是比另一种更好的技术.它们根本无法以这种方式进行比较.

您还可以查找一些LINQ和XSLT示例,并尝试对其他示例执行相同的操作.我认为那肯定有助于理解.

祝你好运!
LINQ is a language feature where as XSLT is document that defines the transformation of another document.

With LINQ you could select data based on parameters from outside of the set of data. The user can, for examle, choose a function like Sum, Min, Max from a combobox and used in the LINQ statement to produce the answer.

With XSLT this is different because the XSLT will not change. If you would like the XSLT to produce the Sum, this is already be defined in the XSLT and either executed always or executed based on information that is part of the XML. XSLT will always produce a new document based on the XML it was given.

The uses for both may have some similarities but are quite different. LINQ gives flexibility in applications but XSLT is great for transforming data in a predefined way outside of the application (therfore easy to update if needed). With XSLT you can easily transform a XML to HTML. They offer bot great functionality but will and cannot replace each other.

Well, hopefully this gave you some idea about it. There are many more differences and similarities but important to remenber is that it''s not possible to say one is a better technology than the other. They simply can''t be compared in that way.

You could also look up some LINQ and XSLT example and try to do the same with the other. I think that would certainly help to understand.

Good luck!


这篇关于LINQ to xml与XQuery或XSLT的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆