Sign In/My Account | View Cart  
advertisement

Article:
 Processing RSS
Subject: XQuery and XSLT
Date: 2003-04-12 08:17:13
From: Michael Champion

As best I understand it, and for situations that don't involve XQuery's deeper support for XML Schema data types, XQuery and XSLT are more or less equivalent in functionality. I believe that all the use cases in the XQuery specification can be implemented with either.


So why are both needed? Not everyone would agree that they are, and both are (AFAIK) Turing-complete programming languages. The best explanation I can offer is that each is optimized for the needs of different audiences. XSLT tends to be somewhat easier for document-oriented applications, XQuery somewhat easier for data-oriented applications, especially by those coming from a SQL background and those who need a "native XML programming language" rather than a "template-driven XML transformation" tool.


Previous Message Previous Message   Next Message Next Message


Titles Only Full Threads Newest First
  • XQuery and XSLT
    2003-10-19 03:33:26 Dimitre Novatchev [Reply]

    > One way to think of them: XSLT is essentially a > special-purpose scripting language. It is
    > designed to be interpreted, and there is no
    > static type-checking or optimization.


    Speking about XSLT 2.0 almost everything in the above statement is quite wrong:


    - there *is* static type checking.


    - there is optimization performed even in most
    XSLT 1.0 processors.



    > XQuery aspires to be a real general-purpose
    > programming language, albeit one with syntax
    > and data types optimized for XML applications.
    > It supports (at least optionally) type-
    > checking, optimization, and compilation.


    So you imply that XSLT is not so real general-purpose programming language than XQuery?


    Of course this is not true -- XSLT 2.0 has all major features that XQuery has.


    What XQuery doesn't offer and what happens to be one of the most powerful features of XSLT is the mechanism to apply the best-matching template out of many.


    There are great consequences from this -- e.g. it is possible to implement higher order functions and functional programming in XSLT (see the FXSL library), while this does not seem possible to be done with XQuery.


    Dimitre Novatchev




  • XQuery and XSLT
    2003-04-18 21:40:44 Per Bothner [Reply]

    > So why are both needed?


    One way to think of them: XSLT is essentially a special-purpose scripting language. It is designed to be interpreted, and there is no static type-checking or optimization. XQuery aspires to be a real general-purpose programming language, albeit one with syntax and data types optimized for XML applications. It supports (at least optionally) type-checking, optimization, and compilation.


    This is of course a gray boundary. It is possible to compile and statically analyze at least a subset of XSLT, and it is possible to do quick-and-dirty scripting in XQuery. But your point about "deeper support for XML Schema data types" goes beyond Schema: Having a statically analyzable syntax and type system allows you to catch type errors as compile-time errors rather than run-time errors which I think is very valuable.


Sponsored By: