/** * Compile an XPath expression in the context of this stylesheet element * * @param expression the source text of the XPath expression * @param attIndex the index position of the attribute containing the XPath expression, or * -1 if the expression is in a text node * @return the compiled expression tree for the XPath expression. In the case of an error, * returns an ErrorExpression that will fail at run-time if executed. */ public Expression makeExpression(String expression, int attIndex) { try { StaticContext env = staticContext; if (attIndex >= 0) { StructuredQName attName = getAttributeList().getNodeName(attIndex).getStructuredQName(); env = getStaticContext(attName); } return ExpressionTool.make(expression, env, 0, Token.EOF, getCompilation().getCompilerInfo().getCodeInjector()); } catch (XPathException err) { err.maybeSetLocation(allocateLocation()); if (err.isReportableStatically()) { compileError(err); } ErrorExpression erexp = new ErrorExpression(err); erexp.setRetainedStaticContext(makeRetainedStaticContext()); erexp.setLocation(allocateLocation()); return erexp; } }
/** * Compile an XPath expression in the context of this stylesheet element * * @param expression the source text of the XPath expression * @param attIndex the index position of the attribute containing the XPath expression, or * -1 if the expression is in a text node * @return the compiled expression tree for the XPath expression. In the case of an error, * returns an ErrorExpression that will fail at run-time if executed. */ public Expression makeExpression(String expression, int attIndex) { try { StaticContext env = staticContext; if (attIndex >= 0) { StructuredQName attName = getAttributeList().getNodeName(attIndex).getStructuredQName(); env = getStaticContext(attName); } return ExpressionTool.make(expression, env, 0, Token.EOF, getCompilation().getCompilerInfo().getCodeInjector()); } catch (XPathException err) { err.maybeSetLocation(allocateLocation()); if (err.isReportableStatically()) { compileError(err); } ErrorExpression erexp = new ErrorExpression(err); erexp.setRetainedStaticContext(makeRetainedStaticContext()); erexp.setLocation(allocateLocation()); return erexp; } }
} else { ErrorExpression erexp = new ErrorExpression(err); erexp.setLocation(allocateLocation()); return erexp;
} else { ErrorExpression erexp = new ErrorExpression(err); erexp.setLocation(allocateLocation()); return erexp;