fn:function-lookup could be used to call current-group and current-grouping-key indirectly within a pattern. Thus the errors XTSE1060 and XTSE01070 could be reaised dynamically.
We have introduced dynamic errors (1061, 1071) to be raised if current-group() or current-grouping-key() are called when the current group is absent. I propose that we use these error codes: we should define that within a pattern, the current group is absent, and therefore these errors apply to this case.
This is consistent with what happens if a pattern calls my:f() and my:f() calls current-group().
The WG accepted the proposal in comment #1.
Change applied as agreed (draft N).