Xquery instead of xslt

T

Tom Corcoran

I am working to ease updating of a html page by transforming 2 xml files. I
was going to use xslt for this and had bought 2 unopened books, wrox xslt
and o'reilly's xslt cookbook. But am now wondering if I am better of
learning XQuery instead?

Any thought and opinions would be appreciated.

Cheers - Tom.

The Architect: "Hope, it is the quintessential human delusion,
simultaneously the source of your greatest strength, and your greatest
weakness" The Matrix Reloaded (2003)
 
S

strajan

Please see the following from :
http://www.ibiblio.org/xml/slides/sd2002west/xslt2/109.html

=========
What's the difference between XQuery and XSLT?
XSLT is document-driven; XQuery is program driven

XSLT is functional; XQuery is imperative

XSLT is written in XML; XQuery is not

An assertion (unproven): XSLT 2.0 can do everything XQuery can do

=============

I guess for transforming xml to html, xsl would be a better tool.

All the best.
 
X

Xavier Franc

XSLT is functional; XQuery is imperative
Wrong. XML Query is a functional language, like XSLT.
A more correct assertion would be:
XSLT is declarative, XQuery is imperative
XSLT is written in XML; XQuery is not
For a human programmer, a non-XML syntax is an advantage IMHO.
Anyway there was and there will be again a XML syntax for XML Query.
An assertion (unproven): XSLT 2.0 can do everything XQuery can do
It is almost true, but XQ has a more flexible processing model: you can
build intermediary trees, and work on these trees in the same way as
on input documents.
Conversely, XQ lacks of the template/apply-templates mechanism of XSLT.
It can however be emulated by functions and 'typeswitch'.

So Apart from the syntax, XML Query and XSLT2 are quite
close to each other. They could even be unified in one language.

* XQuery is not yet a stable recommendation. For production
projects it is not advisable to use it.

* Usable up to date open-source implementations:
- Michael Kay's Saxon 7 (http://saxon.sf.net):
XML Query and XSLT 2 (almost complete)
- Qizx/open (http://www.xfra.net/qizxopen/):
XML Query only
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,769
Messages
2,569,579
Members
45,053
Latest member
BrodieSola

Latest Threads

Top