Ajmal Razeel
Ajmal Razeel

Reputation: 1701

how to use group by in xquery version 1.0

I am working on a FLWOR XQuery expression and I want to use the group by in my code. but it gives me this error everytime I use group by "XPST0003: To use XQuery 3.0 syntax, you must request XQuery version 3.0 both in the prolog and in the command line or API".

Please help me. I am currently using XQuery version 1.0 or SAXON-EE XQuery 9.5.1.2. I running Oxygen for this purpose.

Upvotes: 1

Views: 331

Answers (1)

Michael Kay
Michael Kay

Reputation: 163322

group by is not available in XQuery 1.0. In Saxon 9.5, to use XQuery 3.0 you must

  1. use a licensed edition of Saxon-EE (which is automatic if you use oXygen)
  2. specify xquery version 3.0 in the query prolog
  3. configure Saxon to support XQuery version 3.0, e.g. by specifying -qversion:3.0 on the command line, or by ticking the box "Enable XQuery 3.0 support" in oXygen.

These rules were relaxed in Saxon 9.6. The reason for these rules in 9.5 was that at the time 9.5 came out in 2013, the specification of XQuery 3.0 was not yet stable, and we felt it was for "bleeding edge" users only. Given that 9.5 was released before XQuery 3.0 was finalized, you should use 3.0 features with care since the spec might have changed. Ideally, move to Saxon 9.6.

Upvotes: 2

Related Questions