John Schlesinger wrote:
> Jonathan wrote:
>
> "A query language needs to be optimizable for queries. To make this
> possible, we need to be able to discover equivalences so that queries
> can be rewritten flexibly based on the performance parameters of various
> kinds of access. Both the XQuery language and the XML Query Algebra are
> designed to make this possible."
>
> Without trying to get to much into the debate, I would think that if
> there is a need to re-write queries the most obvious way to specify the
> re-write would be to use XSL. This is what it is for, after all.
> However, to do this the query needs to be XML. Therefore, the need for
> query re-write is, for me, a strong argument that the query syntax
> should be XML. This, in turn, suggests that FLWR is inferior for this
> purpose than XSLT.
An XML-based representation of the XQuery parse tree can be used for this kind of rewriting - in fact, at Software AG, we do this in our XQuery prototype. And I agree that XSLT can be used for the transformations, though we decided to use a different language.
But that doesn't mean you make your poor user type in the XML. That's what parsers are for. There are two executable grammars for XQuery in the appendix.
Jonathan