This is an archived snapshot of W3C's public bugzilla bug tracker, decommissioned in April 2019. Please see the home page for more details.
The description of "group-by" states "The name of each grouping variable must be equal (by the eq operator on expanded QNames) to the name of a bound variable in the input tuple stream; otherwise a static error is raised [err:XQST0094]." But the definition of XQST0094 states "In the group by clause of a FLWOR expression, it is a static error if the name of a grouping variable is not equal (by the eq operator on expanded QNames) to the name of a variable that is bound by a for or let clause that precedes the group by clause." This leaves it unclear whether it is permissible for the grouping variable to be one that is bound by a previous count, group-by, or window clause. (I'm also puzzled by the qualifier "bound" in "bound variable". Is it possible to have unbound variables in the tuple stream?)
The wording in the spec changed, and the wording in the error message did not change along with it. I have changed the wording in the error message to match.