[xquery-talk] prolog ordering

Michael Kay mhk at mhk.me.uk
Fri Nov 18 11:12:09 PST 2005


Thanks for pointing this out. It seems Saxon is still implementing the rules
from the Feb 2005 spec, where the syntax was:

[6]    	Prolog 	   ::=    	(Setter Separator)* ((Import | NamespaceDecl
| DefaultNamespaceDecl) Separator)* ((VarDecl | FunctionDecl | OptionDecl)
Separator)*

(This history accounts for the odd existence of Setter as a separate
production rule.)

Implementing the change is not entirely trivial because the URIs used in
module and schema imports can't be resolved until after the base URI has
been read. But I'll cope! Any relaxation of these ordering rules is a good
thing for users. (Someone pointed out to me a few days ago that no-one could
ever remember the correct order of divisions in a COBOL program, you always
had to do it by copy and paste.)

Michael Kay
http://www.saxonica.com/ 

> -----Original Message-----
> From: talk-bounces at xquery.com 
> [mailto:talk-bounces at xquery.com] On Behalf Of Dave Pawson
> Sent: 18 November 2005 10:31
> To: talk at xquery.com
> Subject: [xquery-talk] prolog ordering
> 
> http://www.w3.org/TR/xquery/#prod-xquery-Prolog
> 
> shows
> 
> [6]    	Prolog 	   ::=    	(
>    (DefaultNamespaceDecl | Setter | NamespaceDecl | Import)
>     Separator)*
>    (
>      (VarDecl | FunctionDecl | OptionDecl)
>    Separator)*
> 
> (I think there is a paren mismatch btw)
> 
> declare boundary-space preserve;
> declare default element namespace "";
> declare base-uri "file:///myjava/xquery/data/";
> (: seemingly relative to xml:base :)
> import module namespace dp  = "urn:modul" at "modul.xq";
> 
> Using Saxon 8 shows the error
> 
> Error on line 5 column 1 of file:/C:/myjava/xquery/data/test10.xq:
>   XPST0003: XQuery syntax error in #... 
> "file:///myjava/xquery/data/"#:
>     'declare base-uri' must appear earlier in the query prolog
> Failed to compile query
> 
> If I read the spec right (not a common case), then
> expanding the first group, setters, shows
> 
>  (DefaultNamespaceDecl
>   BoundarySpaceDecl
>   DefaultCollationDecl
>   BaseURIDecl
>   ConstructionDecl
>   OrderingModeDecl
>   EmptyOrderDecl
>   CopyNamespacesDecl
>   NamespaceDecl
>   Import)   Separator )*
> 
> in which case the elements can appear in any order?
> 
> 
> 
> 
> regards
> --
> Dave Pawson
> XSLT XSL-FO FAQ.
> http://www.dpawson.co.uk
> 
> _______________________________________________
> talk at xquery.com
> http://xquery.com/mailman/listinfo/talk
> 




More information about the talk mailing list