/** * Check number of arguments. <BR> * A convenience routine for use in subclasses. * @param min the minimum number of arguments allowed * @param max the maximum number of arguments allowed * @param visitor an expression visitor * @return the actual number of arguments * @throws net.sf.saxon.trans.XPathException if the number of arguments is out of range */ protected int checkArgumentCount(int min, int max, ExpressionVisitor visitor) throws XPathException { int numArgs = argument.length; if (min==max && numArgs != min) { throw new XPathException("Function " + getDisplayName() + " must have " + min + pluralArguments(min), this); } if (numArgs < min) { throw new XPathException("Function " + getDisplayName() + " must have at least " + min + pluralArguments(min), this); } if (numArgs > max) { throw new XPathException("Function " + getDisplayName() + " must have no more than " + max + pluralArguments(max), this); } return numArgs; }
/** * Check number of arguments. <BR> * A convenience routine for use in subclasses. * @param min the minimum number of arguments allowed * @param max the maximum number of arguments allowed * @param visitor an expression visitor * @return the actual number of arguments * @throws net.sf.saxon.trans.XPathException if the number of arguments is out of range */ protected int checkArgumentCount(int min, int max, ExpressionVisitor visitor) throws XPathException { int numArgs = argument.length; if (min==max && numArgs != min) { throw new XPathException("Function " + getDisplayName() + " must have " + min + pluralArguments(min), this); } if (numArgs < min) { throw new XPathException("Function " + getDisplayName() + " must have at least " + min + pluralArguments(min), this); } if (numArgs > max) { throw new XPathException("Function " + getDisplayName() + " must have no more than " + max + pluralArguments(max), this); } return numArgs; }
/** * Check number of arguments. <BR> * A convenience routine for use in subclasses. * @param min the minimum number of arguments allowed * @param max the maximum number of arguments allowed * @param visitor an expression visitor * @return the actual number of arguments * @throws net.sf.saxon.trans.XPathException if the number of arguments is out of range */ protected int checkArgumentCount(int min, int max, ExpressionVisitor visitor) throws XPathException { int numArgs = argument.length; if (min==max && numArgs != min) { throw new XPathException("Function " + getDisplayName() + " must have " + min + pluralArguments(min), this); } if (numArgs < min) { throw new XPathException("Function " + getDisplayName() + " must have at least " + min + pluralArguments(min), this); } if (numArgs > max) { throw new XPathException("Function " + getDisplayName() + " must have no more than " + max + pluralArguments(max), this); } return numArgs; }
/** * Diagnostic print of expression structure. The abstract expression tree * is written to the supplied output destination. */ public void explain(ExpressionPresenter out) { out.startElement("functionCall"); out.emitAttribute("name", getDisplayName()); for (int a=0; a<argument.length; a++) { argument[a].explain(out); } out.endElement(); }
/** * Diagnostic print of expression structure. The abstract expression tree * is written to the supplied output destination. */ public void explain(ExpressionPresenter out) { out.startElement("functionCall"); out.emitAttribute("name", getDisplayName()); for (int a=0; a<argument.length; a++) { argument[a].explain(out); } out.endElement(); }
/** * Check number of arguments. <BR> * A convenience routine for use in subclasses. * * @param min the minimum number of arguments allowed * @param max the maximum number of arguments allowed * @return the actual number of arguments * @throws net.sf.saxon.trans.XPathException if the number of arguments is out of range */ protected int checkArgumentCount(int min, int max) throws XPathException { int numArgs = getArity(); String msg = null; if (min == max && numArgs != min) { msg = "Function " + getDisplayName() + " must have " + pluralArguments(min); } else if (numArgs < min) { msg = "Function " + getDisplayName() + " must have at least " + pluralArguments(min); } else if (numArgs > max) { msg = "Function " + getDisplayName() + " must have no more than " + pluralArguments(max); } if (msg != null) { XPathException err = new XPathException(msg, "XPST0017"); err.setIsStaticError(true); err.setLocation(getLocation()); throw err; } return numArgs; }
/** * Diagnostic print of expression structure. The abstract expression tree * is written to the supplied output destination. */ public void explain(ExpressionPresenter out) { out.startElement("functionCall"); out.emitAttribute("name", getDisplayName()); for (int a=0; a<argument.length; a++) { argument[a].explain(out); } out.endElement(); }
/** * The toString() method for an expression attempts to give a representation of the expression * in an XPath-like form, but there is no guarantee that the syntax will actually be true XPath. * In the case of XSLT instructions, the toString() method gives an abstracted view of the syntax */ public String toString() { FastStringBuffer buff = new FastStringBuffer(120); buff.append(getDisplayName()); Iterator iter = iterateSubExpressions(); boolean first = true; while (iter.hasNext()) { buff.append(first ? "(" : ", "); buff.append(iter.next().toString()); first = false; } buff.append(")"); return buff.toString(); }
/** * Check number of arguments. <BR> * A convenience routine for use in subclasses. * * @param min the minimum number of arguments allowed * @param max the maximum number of arguments allowed * @return the actual number of arguments * @throws net.sf.saxon.trans.XPathException if the number of arguments is out of range */ protected int checkArgumentCount(int min, int max) throws XPathException { int numArgs = getArity(); String msg = null; if (min == max && numArgs != min) { msg = "Function " + getDisplayName() + " must have " + pluralArguments(min); } else if (numArgs < min) { msg = "Function " + getDisplayName() + " must have at least " + pluralArguments(min); } else if (numArgs > max) { msg = "Function " + getDisplayName() + " must have no more than " + pluralArguments(max); } if (msg != null) { XPathException err = new XPathException(msg, "XPST0017"); err.setIsStaticError(true); err.setLocation(getLocation()); throw err; } return numArgs; }
/** * The toString() method for an expression attempts to give a representation of the expression * in an XPath-like form, but there is no guarantee that the syntax will actually be true XPath. * In the case of XSLT instructions, the toString() method gives an abstracted view of the syntax */ public String toString() { FastStringBuffer buff = new FastStringBuffer(120); buff.append(getDisplayName()); Iterator iter = iterateSubExpressions(); boolean first = true; while (iter.hasNext()) { buff.append(first ? "(" : ", "); buff.append(iter.next().toString()); first = false; } buff.append(first ? "()" : ")"); return buff.toString(); }
/** * The toString() method for an expression attempts to give a representation of the expression * in an XPath-like form, but there is no guarantee that the syntax will actually be true XPath. * In the case of XSLT instructions, the toString() method gives an abstracted view of the syntax */ public String toString() { FastStringBuffer buff = new FastStringBuffer(120); buff.append(getDisplayName()); Iterator iter = iterateSubExpressions(); boolean first = true; while (iter.hasNext()) { buff.append(first ? "(" : ", "); buff.append(iter.next().toString()); first = false; } buff.append(")"); return buff.toString(); }
private void gatherGetPaths(Expression exp, PathBuilder path, boolean reset) { if (exp instanceof StringLiteral && exp.getParentExpression() instanceof FunctionCall && "map:get".equals(((FunctionCall) exp.getParentExpression()).getDisplayName())) { path.addPathSegment(AxisType.CHILD, null, ((StringLiteral) exp).getStringValue()); } else if (exp instanceof ContextItemExpression) {