[xquery-talk] Implementing XQuery: parsing XQuery *and* XSL-T

Michael Kay mhk at mhk.me.uk
Thu Feb 16 23:26:02 PST 2006

> * One has two different scanners, one for XQuery and one for 
> XSL-T, both 
> producing tokens for the same parser to consume. For example, 
> the XSL-T 
> scanner would validate elements and attributes, perform whitespace 
> normalization, but other than that produce tokens for 
> consumption by the 
> parser.

As you probably know, Saxon has separate front-ends for XSLT and XQuery:
these produce the initial AST, and after than the code is largely common.

One could probably go further than this in commoning-up the two, but I'm not
sure much would be gained. With XSLT, for example, fixup of names can be
done on-the-fly, because once the XML parser has built a basic tree
structure it's easy to find objects such as functions and variables by name,
whether or not they are forwards references; in XQuery forwards references
are a much bigger problem, for example with constructs such as

<e a="{a/b/p:d["}"]}" xmlns:p="www.ns.com"/>

where the namespace prefix is a forwards reference. So I think it makes
sense to do the fixup operations in different ways for each language.

Michael Kay


More information about the talk mailing list