GroupingSpec spec = specs[i];
Sequence result = spec.getKeyExpr().eval(contextSeq, dynEnv);
Sequence atomized = result.atomize(dynEnv);
IFocus atomizedItor = atomized.iterator();
final Item groupKey;
if(atomizedItor.hasNext()) {
AtomicValue atom = (AtomicValue) atomizedItor.next();
if(atomizedItor.hasNext()) {
atomizedItor.closeQuietly();
throw new DynamicError("err:XQDY0095", "Illegal resulting value for a grouping variable: "