* of {@link ContextStackFrame}
* @throws java.util.NoSuchElementException
* iteration has no more elements.
*/
/*@Nullable*/ public ContextStackFrame next() {
XPathContextMajor context = next;
if (context == null) {
return null;
}
int construct = context.getOriginatingConstructType();
Object origin = context.getOrigin();
if (construct == Location.CONTROLLER) {
next = getMajorCaller(context);
return new ContextStackFrame.CallingApplication();
} else if (construct == Location.BUILT_IN_TEMPLATE) {
next = getMajorCaller(context);
return new ContextStackFrame.BuiltInTemplateRule();
}
if (construct == Location.FUNCTION_CALL) {
ContextStackFrame.FunctionCall sf = new ContextStackFrame.FunctionCall();
UserFunctionCall ufc = (UserFunctionCall)origin;
sf.setSystemId(ufc.getSystemId());
sf.setLineNumber(-1); //(ufc.getLineNumber());
sf.setContainer(ufc.getContainer());
sf.setFunctionName(ufc.getFunctionName());
sf.setContextItem(context.getContextItem());
next = getMajorCaller(context);
return sf;
} else if (construct == StandardNames.XSL_APPLY_TEMPLATES) {
ContextStackFrame.ApplyTemplates sf = new ContextStackFrame.ApplyTemplates();
ApplyTemplates loc = (ApplyTemplates)origin;
sf.setSystemId(loc.getSystemId());
sf.setLineNumber(-1); //(loc.getLineNumber());
sf.setContainer(loc.getContainer());
sf.setContextItem(context.getContextItem());
next = getMajorCaller(context);
return sf;
} else if (construct == StandardNames.XSL_CALL_TEMPLATE) {
ContextStackFrame.CallTemplate sf = new ContextStackFrame.CallTemplate();
CallTemplate loc = (CallTemplate)origin;
sf.setSystemId(loc.getSystemId());
sf.setLineNumber(-1); //(loc.getLineNumber());
sf.setContainer(loc.getContainer());
sf.setTemplateName(loc.getObjectName());
sf.setContextItem(context.getContextItem());
next = getMajorCaller(context);
return sf;
} else if (construct == StandardNames.XSL_VARIABLE) {
ContextStackFrame.VariableEvaluation sf = new ContextStackFrame.VariableEvaluation();
GeneralVariable var = ((GeneralVariable)origin);
sf.setSystemId(var.getSystemId());
sf.setLineNumber(-1); //(var.getLineNumber());
sf.setContainer(var.getContainer());
sf.setContextItem(context.getContextItem());
sf.setVariableName(var.getVariableQName());
next = getMajorCaller(context);
return sf;
} else {
//other context changes are not considered significant enough to report