[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: "Dimitre Novatchev" <dnovatchev@xxxxxxxxx>
Date: Fri, 17 Nov 2006 07:00:42 -0800
xquery and xslt
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


Speaking about one-liners, this is also quite possible with XSLT
2.0/XPath2.0. See for example:

http://www.idealliance.org/papers/extreme/proceedings/xslfo-pdf/2006/Novatchev01/EML2006Novatchev01.pdf

Such one-liners can be evaluated not exactly from the command-line but
from the "command-line" of the new XPath Visualizer for XPath 2.0.
This tool is now ready to use. It is based on Saxon 8.x. I hope to be
able to distribute it widely after getting approval from my company.



--
Cheers,
Dimitre Novatchev
---------------------------------------
Truly great madness cannot be achieved without significant intelligence.
---------------------------------------
To invent, you need a good imagination and a pile of junk
-------------------------------------
You've achieved success in your field when you don't know whether what
you're doing is work or play


On 11/17/06, Michael Kay <mike@xxxxxxxxxxxx> wrote:


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.