[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

RE: XQuery and XSLT

Subject: RE: XQuery and XSLT
From: "Michael Kay" <mike@xxxxxxxxxxxx>
Date: Fri, 17 Nov 2006 09:20:47 -0000
RE:  XQuery and XSLT
I've written on this a couple of times:

http://idealliance.org/proceedings/xtech05/papers/02-03-01/

http://xtech06.usefulinc.com/schedule/paper/13

My own view (and my own usage) is to use:

* XQuery for small jobs, XSLT for large ones

* XQuery for extracting facts, XSLT for presenting or transforming documents

The two big things that are missing from XQuery are template rules and
import precedence. Together, the absence of these features makes it much
more difficult to write flexible code that can be adapted and reused to
handle different kinds of input document or produce different kinds of
output. There are also many smaller things missing, such as grouping, date
and number formatting, control over serialization.

As a transformation language, one area where XQuery is very weak is for
tasks that involve making a few changes to a document while leaving most
things unchanged - for example, deleting all the Note elements. Eventually
XQuery Update will solve this problem, but for the moment, XSLT wins hands
down.

The main advantage of XQuery is that it is more concise (less verbose).
That's a great advantage when you want to do a one-off enquiry ("list me the
tests where Saxon's result differed from the published result") - it becomes
a one-liner that you can do straight from the command line, rather than
loading up your IDE. But as soon as you want to turn this one-liner into a
more sophisticated report, which can be run repeatedly, my personal choice
would be XSLT. When the application has a long life, a bit of verbosity does
no harm. The test results which the XQuery working group presented to Tim
Berners Lee yesterday were formatted using XSLT.

As for learning, there is good experimental evidence that XQuery is easier
to learn. This isn't surprising: it's a smaller and more concise language,
and the rule-based programming style that works best with XSLT is unfamiliar
to many people new to the language. For professionals working with XML every
day, however, I think you need both tools in your kitbag: and 90% of the
learning is transferable between them.

Michael Kay
http://www.saxonica.com/

 

> -----Original Message-----
> From: Jesper Tverskov [mailto:jesper@xxxxxxxxxxx] 
> Sent: 17 November 2006 07:07
> To: xsl-list@xxxxxxxxxxxxxxxxxxxxxx
> Subject:  XQuery and XSLT
> 
> Hi list
> 
> As a fan of XSLT and almost addicted to it, I am surprised to 
> learn that XQuery is not just for views joining documents, 
> filtering, grouping and sorting, but that XQuery is also 
> great for transformations like XML to HTML and XML to XSL-FO/pdf.
> 
> I am wondering: What are the strong and weak sides of XQuery 
> and XSLT making it necessary to learn both?
> 
> Cheers,
> 
> Jesper Tverskov
> www.xmltraining.biz

Current Thread

PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.