开发者

XQuery vs XSLT for transforming data

开发者 https://www.devze.com 2023-01-03 00:33 出处:网络
What do you use in your applications for transforming 开发者_如何学PythonXML data to other data types? WHY?While XQuery can be used for simple transformations, it lacks the power and sofistication of

What do you use in your applications for transforming 开发者_如何学PythonXML data to other data types? WHY?


While XQuery can be used for simple transformations, it lacks the power and sofistication of XSLT (especially templates and the <xsl:apply-templates> instruction).

XSLT is a language that was especially designed to process tree structures. It is still best at doing this.

In cases when accessing an XML database it would be a good decision to use (the efficiency of) XQuery to extract the necessary XML nodes and then do the transformation with XSLT from here on. Some XSLT 2.x / XQuery processors do allow this (via extensions) even now. The next wave of XSLT 2.x/XQuery 1.x specifications will most probably make such interoperability an official feature of these languages.


If you look at the Wikipedia Entry they have a section that compares the two.

In my view I see XSLT as a Programmable presentation layer for data.


It depends what type of "transformation" you need, XQuery allows you to perform queries on your XML data, a bit like SQL.

XSLT allows you to apply a style on XML, like CSS does with HTML.

0

精彩评论

暂无评论...
验证码 换一张
取 消