This syntax
declare variable $voclib:libversion as xs:decimal {1.0};
was used in some of the working drafts of XQuery but is not permitted by the final language spec.
Generally during the development of XQuery I made a point of not supporting constructs once they had been removed from the spec, on the grounds that the longer you leave such support in the product, the harder it is to get rid of it. Clearly some other product vendors decided differently.
Michael Kay

From: [] On Behalf Of Calum Byrom
Sent: 17 April 2008 13:32
Subject: [saxon] Problem with XQuery declare variable syntax


I'd like to use the saxon libraries to replace legacy code which uses an eXist DB to transform XML docs via various XQueries.  If I try and use these with the 'java net.sf.saxon.Query' approach, or load these in eclipse, I get lots of errors along the lines of:

XPST0003: XQuery syntax error in #...:libversion as xs:decimal {1.0#:
    Expected ':=' or 'external' in variable declaration

- referring to lines in the XQuery file, such as:

declare variable $voclib:libversion as xs:decimal {1.0};

Do the saxon libraries not support this particular syntax?  NB, I can get rid of the error by rewriting the line as

declare variable $voclib:libversion as xs:decimal := 1.0;

I'd rather not have to refactor the existing xquery codebase as there are a lot of files in there and I'm not sure if this change would cause problems if running the query against the eXist DB (i.e. to maintain backward compatiblity).

I'm not really familiar with XQuery, so any help here would be much appreciated.