public Sequence eval(Sequence contextSequence, Item contextItem) throws XPathException {
// System.out.println("enter "+toString());//+" : contextItem = "+contextItem.toString());//TODO: remove
// Save the local variable stack
LocalVariable mark = context.markLocalVariables(false);
Sequence value = null;
for (Entry<String, WithParam> entry : params.entrySet()) {
value = entry.getValue().eval(contextSequence, contextItem);
// Declare the iteration variable
LocalVariable var = new LocalVariable(entry.getValue().getName());
// var.setSequenceType(sequenceType);
context.declareVariableBinding(var);
var.setValue(value);
}
XSLStylesheet xslt = getXSLContext().getXSLStylesheet();
Sequence result = xslt.template(name, contextSequence, contextItem);