oforEach.completionCondition.branchCount = _context.compileExpr(forEach.getCompletionCondition());
}
// ForEach 'adds' a counter variable in inner scope
if (__log.isDebugEnabled()) __log.debug("Adding the forEach counter variable to inner scope.");
Scope s = forEach.getChild().getScope();
// Checking if a variable using the same name as our counter is already defined.
// The spec requires a static analysis error to be thrown in that case.
if (s.getVariableDecl(forEach.getCounterName()) != null)
throw new CompilationException(__cmsgs.errForEachAndScopeVariableRedundant(forEach.getCounterName()).setSource(src));
OXsdTypeVarType counterVarType = new OXsdTypeVarType(_context.getOProcess());
counterVarType.xsdType = new QName(XMLConstants.W3C_XML_SCHEMA_NS_URI, "unsignedInt");
OScope.Variable countervar = new OScope.Variable(_context.getOProcess(),counterVarType);