Package net.sf.saxon.expr

Examples of net.sf.saxon.expr.Expression


    * Expand the template. Called when the template is invoked using xsl:call-template.
    * Invoking a template by this method does not change the current template.
    */

    public TailCall expand(XPathContext context) throws XPathException {
        Expression body = getBody();
        if (body==null) {
            // fast path for an empty template
            return null;
        }
        if (body instanceof Instruction) {
            return ((Instruction)body).processLeavingTail(context);
        } else {
            body.process(context);
            return null;
        }
    }
View Full Code Here


                }
                var.setSelectExpression(select);
            }
        }
        if (global) {
            Expression exp2 = select;
            if (exp2 != null) {
                try {
                    exp2 = select.simplify(staticContext).analyze(staticContext, Type.NODE_TYPE);
                } catch (XPathException err) {
                    compileError(err);
View Full Code Here

    * Simplify and validate.
    * This is a pure function so it can be simplified in advance if the arguments are known
    */

     public Expression simplify(StaticContext env) throws XPathException {
        Expression e = simplifyArguments(env);

        // compile the regular expression once if possible
        if (!(e instanceof Value)) {
            regexp = Matches.tryToCompile(argument, 1, 2);
            // check that it's not a pattern that matches ""
View Full Code Here

    * @return the simplified expression
    * @throws net.sf.saxon.xpath.StaticError if any error is found (e.g. invalid regular expression)
    */

     public Expression simplify(StaticContext env) throws XPathException {
        Expression e = simplifyArguments(env);

        // compile the regular expression once if possible
        if (!(e instanceof Value)) {
            regexp = Matches.tryToCompile(argument, 1, 2);
        }
View Full Code Here

    /**
    * Determine the static cardinality
    */

    public int computeCardinality() {
        Expression expression = argument[0];
        if (!Cardinality.allowsMany(expression.getCardinality())) {
            return StaticProperty.ALLOWS_ZERO_OR_ONE;
        } else {
            return StaticProperty.ALLOWS_ZERO_OR_MORE;
        }
        // may have to revise this if the argument can be a list-valued element or attribute
View Full Code Here

                                    hrefSequence,
                                    this,
                                    context,
                                    info);

        Expression expression = argument[0];
        if (!Cardinality.allowsMany(expression.getCardinality())) {
            return map;
        } else {
            return new DocumentOrderIterator(map, GlobalOrderComparer.getInstance());
            // this is to make sure we eliminate duplicates: two href's might be the same
        }
View Full Code Here

            }
        }

        Block b = new Block();
        b.setLocationId(allocateLocationId(getSystemId(), getLineNumber()));
        Expression action = b;
        Expression[] children = compileChildren(exec, b, true);
        if (children.length==1) {
            action = children[0];
        }
        Expression[] conditions = {test};
View Full Code Here

        return null;
    }

    public static void simplify(WithParam[] params, StaticContext env) throws XPathException {
         for (int i=0; i<params.length; i++) {
            Expression select = params[i].getSelectExpression();
            if (select != null) {
                params[i].setSelectExpression(select.simplify(env));
            }
        }
    }
View Full Code Here

        }
    }

    public static void analyze(WithParam[] params, StaticContext env, ItemType contextItemType) throws XPathException {
         for (int i=0; i<params.length; i++) {
            Expression select = params[i].getSelectExpression();
            if (select != null) {
                params[i].setSelectExpression(select.analyze(env, contextItemType));
            }
        }
    }
View Full Code Here

     * method for use by subclasses.
     */

    public static void promoteParams(WithParam[] params, PromotionOffer offer) throws XPathException {
        for (int i=0; i<params.length; i++) {
            Expression select = params[i].getSelectExpression();
            if (select != null) {
                params[i].setSelectExpression(params[i].promote(offer));
            }
        }
    }
View Full Code Here

TOP

Related Classes of net.sf.saxon.expr.Expression

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.