context.pushDocumentContext();
try {
//bv : Declare grouping variables and initiate grouped sequence
LocalVariable groupKeyVar[] = null;
if (groupSpecs != null) {
groupedSequence = new GroupedValueSequenceTable(groupSpecs, varName, context);
groupKeyVar = new LocalVariable[groupSpecs.length];
for (int i = 0 ; i < groupSpecs.length ; i++) {
groupKeyVar[i] = new LocalVariable(QName.parse(context,
groupSpecs[i].getKeyVarName(),null));
groupKeyVar[i].setSequenceType(sequenceType);