// statement. A check for matching is only performed if the select
// state indicates that this when can be evaluated
int returnCode = SKIP_ELEMENT_BODY;
MarinerPageContext pageContext =
ContextInternals.getMarinerPageContext(context);
WhenAttributes attributes = (WhenAttributes) papiAttributes;
Value expr = null;
SelectState state = null;
try {
state = pageContext.peekSelectState();
} catch (EmptyStackException e) {
throw new PAPIException(
exceptionLocalizer.format("select-markup-missing"), e);
}
if (state.isOtherwiseExecuted()) {
throw new PAPIException(
exceptionLocalizer.format("when-preceed-otherwise"));
} else if (!state.isMatched() ||
(state.getPrecept() == Precept.MATCH_EVERY)) {
// Can continue to see if this when should be evaluated since
// every precept can be matched or no matches have yet been found
if (attributes.getExpr() != null) {
ExpressionContext expressionContext =
ContextInternals.getEnvironmentContext(context).
getExpressionContext();
try {
// Determine whether the when expression matches that in
// the containing select
expr = expressionContext.getFactory().
createExpressionParser().parse(attributes.getExpr())
.
evaluate(expressionContext);
if (PipelineExpressionHelper.equals(
state.getExpression().getSequence(),