Package client.net.sf.saxon.ce.expr

Examples of client.net.sf.saxon.ce.expr.Expression


*/
public class IXSLRemoveAttribute extends XSLAttribute {

    @Override
    public Expression compile(Executable exec, Declaration decl) throws XPathException {
        Expression constructor = super.compile(exec, decl);
        return new RemoveAttribute((AttributeCreator)constructor);
    }
View Full Code Here


     * @return a Procedure object representing the compiled attribute set
     * @throws XPathException if a failure is detected
     */
    public Expression compile(Executable exec, Declaration decl) throws XPathException {
        if (referenceCount > 0 ) {
            Expression body = compileSequenceConstructor(exec, decl, iterateAxis(Axis.CHILD));
            if (body == null) {
                body = Literal.makeEmptySequence();
            }

            try {

                ExpressionVisitor visitor = makeExpressionVisitor();
                body = visitor.simplify(body);

                procedure.setUseAttributeSets(useAttributeSets);
                procedure.setName(getObjectName());
                procedure.setBody(body);
                procedure.setSourceLocator(this);
                procedure.setExecutable(exec);

                Expression exp2 = body.optimize(visitor, AnyItemType.getInstance());
                if (body != exp2) {
                    procedure.setBody(exp2);
                    body = exp2;
                }

View Full Code Here

            for (int i = 0; i < topLevel.size(); i++) {
                Declaration decl = topLevel.get(i);
                StyleElement snode = decl.getSourceElement();
                if (!snode.isActionCompleted(StyleElement.ACTION_COMPILE)) {
                    snode.setActionCompleted(StyleElement.ACTION_COMPILE);
                    Expression inst = snode.compile(exec, decl);
                    if (inst != null) {
                        inst.setSourceLocator(snode);
                    }
                }
            }

            // Call type-check method for each user-defined function in the stylesheet. This is no longer
View Full Code Here

        select = typeCheck(select);
        terminate = typeCheck(terminate);
    }

    public Expression compile(Executable exec, Declaration decl) throws XPathException {
        Expression b = compileSequenceConstructor(exec, decl, iterateAxis(Axis.CHILD));
        if (b != null) {
            if (select == null) {
                select = b;
            } else {
                select = Block.makeBlock(select, b);
View Full Code Here

        ComputedElement inst = new ComputedElement(elementName, namespace, nsContext, inheritNamespaces);
        return compileContentExpression(exec, decl, inst);
    }

    private Expression compileContentExpression(Executable exec, Declaration decl, ElementCreator inst) throws XPathException {
        Expression content = compileSequenceConstructor(exec, decl, iterateAxis(Axis.CHILD));

        if (attributeSets != null) {
            UseAttributeSets use = new UseAttributeSets(attributeSets);
            if (content == null) {
                content = use;
            } else {
                content = Block.makeBlock(use, content);
                content.setSourceLocator(this);
            }
        }
        if (content == null) {
            content = new Literal(EmptySequence.getInstance());
        }
View Full Code Here

        flags = typeCheck(flags);

    }

    public Expression compile(Executable exec, Declaration decl) throws XPathException {
        Expression matchingBlock = null;
        if (matching != null) {
            matchingBlock = matching.compileSequenceConstructor(exec, decl, matching.iterateAxis(Axis.CHILD));
        }

        Expression nonMatchingBlock = null;
        if (nonMatching != null) {
            nonMatchingBlock = nonMatching.compileSequenceConstructor(exec, decl, nonMatching.iterateAxis(Axis.CHILD));
        }

        try {
            ExpressionVisitor visitor = makeExpressionVisitor();
            return new AnalyzeString(select,
                                     regex,
                                     flags,
                                     (matchingBlock==null ? null : matchingBlock.simplify(visitor)),
                                     (nonMatchingBlock==null ? null : nonMatchingBlock.simplify(visitor)));
        } catch (XPathException e) {
            compileError(e);
            return null;
        }
    }
View Full Code Here

                    } else {
                        compileError("Unknown XSL attribute " + namePool.getDisplayName(anameCode), "XTSE0805");
                    }
                } else {
                    attributeNames[numberOfAttributes] = anameCode;
                    Expression exp = makeAttributeValueTemplate(atts.getValue(i));
                    attributeValues[numberOfAttributes] = exp;
                    numberOfAttributes++;
                }
            }
View Full Code Here

        NamespaceBinding[] bindings = namespaceCodes.toArray(new NamespaceBinding[namespaceCodes.size()]);
        FixedElement inst = new FixedElement(resultNameCode, bindings, inheritNamespaces);

        inst.setBaseURI(getBaseURI());
        Expression content = compileSequenceConstructor(exec, decl, iterateAxis(Axis.CHILD));

        if (numberOfAttributes > 0) {
            for (int i=attributeNames.length - 1; i>=0; i--) {
                FixedAttribute att = new FixedAttribute(attributeNames[i]);
                try {
                    att.setSelect(attributeValues[i], exec.getConfiguration());
                } catch (XPathException err) {
                    compileError(err);
                }
                att.setSourceLocator(this);
                Expression exp = att;
                if (LogConfiguration.loggingIsEnabled() && LogController.traceIsEnabled()) {
                    TraceExpression trace = new TraceExpression(exp);
                    trace.setNamespaceResolver(this);
                    trace.setConstructType(Location.LITERAL_RESULT_ATTRIBUTE);
                    trace.setSourceLocator(this);
View Full Code Here

            } catch (XPathException err) {
                // fall through to non-optimizing case
            }
        }

        Expression action = compileSequenceConstructor(exec, decl, iterateAxis(Axis.CHILD));
        if (action == null) {
            return null;
        }
        Expression[] conditions = {test};
        Expression[] actions = {action};
View Full Code Here

    public Expression compile(Executable exec, Declaration decl) throws XPathException {
        SortKeyDefinition[] sortKeys = makeSortKeys(decl);
        if (sortKeys != null) {
            useTailRecursion = false;
        }
        Expression sortedSequence = select;
        if (sortKeys != null) {
            sortedSequence = new SortExpression(select, sortKeys);
        }
        compileSequenceConstructor(exec, decl, iterateAxis(Axis.CHILD));
        ApplyTemplates app = new ApplyTemplates(
View Full Code Here

TOP

Related Classes of client.net.sf.saxon.ce.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.