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(_at_)tverskov(_dot_)dk]
Sent: 17 November 2006 07:07
To: xsl-list(_at_)lists(_dot_)mulberrytech(_dot_)com
Subject: [xsl] 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
--~------------------------------------------------------------------
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail:
<mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--
--~------------------------------------------------------------------
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: <mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--