The escape-uri() function is obsolete; it was split into encode-for-uri(), iri-to-uri(), and escape-html-uri(), which all do slightly different things.
Michael Kay

From: [] On Behalf Of Calum Byrom
Sent: 18 April 2008 08:46
To: Mailing list for the SAXON XSLT and XQuery processor
Subject: Re: [saxon] Problem with XQuery declare variable syntax

Thanks Michael - I suspected something along those lines.  On a similar theme, the legacy XQuery docs use the function, 'escape-uri' a lot - and this is not recognised by the saxon parser.  Having done a little search on the web, it appears that the saxon equivalent is 'encode-for-uri'?

Is the original function obsolete; if not, how can I get it working with saxon?



On Thu, Apr 17, 2008 at 6:34 PM, Michael Kay <> wrote:
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.



This email is sponsored by the 2008 JavaOne(SM) Conference
Don't miss this year's exciting event. There's still time to save $100.
Use priority code J8TL2D2.;198757673;13503038;p?
saxon-help mailing list archived at