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

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


         * @throws XPathException if a dynamic error occurs
        */

        public TailCall processLeavingTail() throws XPathException {
            Template nh = rule.getAction();
            XPathContextMajor c2 = evaluationContext.newContext();
            c2.setLocalParameters(params);
            c2.setTunnelParameters(tunnelParams);
            c2.openStackFrame(nh.getStackFrameMap());
            c2.setCurrentTemplateRule(rule);

            // System.err.println("Tail call on template");

            return nh.applyLeavingTail(c2);
        }
View Full Code Here


                        SourceLocator sourceLocator) throws XPathException {
        switch(node.getNodeKind()) {
            case Type.DOCUMENT:
            case Type.ELEMENT:
                SequenceIterator iter = node.iterateAxis(Axis.CHILD);
                XPathContextMajor c2 = context.newContext();
              TailCall tc = ApplyTemplates.applyTemplates(
                        iter, context.getCurrentMode(), parameters, tunnelParams, c2, sourceLocator);
                while (tc != null) {
                    tc = tc.processLeavingTail();
                }
View Full Code Here

        }

        nodeKeys = new Object[allocated * recordSize];
        count = 0;

        XPathContextMajor c2 = context.newContext();
        c2.setCurrentIterator(base);
        c2.setCurrentGroupIterator((GroupIterator)base);
                // this provides the context for evaluating the sort key

        // initialise the array with data

        while (true) {
View Full Code Here

        if (useAttributeSets != null) {
            AttributeSet.expand(useAttributeSets, context);
        }

        if (getStackFrameMap() != null) {
            XPathContextMajor c2 = context.newContext();
            c2.openStackFrame(getStackFrameMap());
            getBody().process(c2);
        } else {
            getBody().process(context);
        }
    }
View Full Code Here

     * of {@link ContextStackFrame}
     * @throws java.util.NoSuchElementException
     *          iteration has no more elements.
     */
    /*@Nullable*/ public ContextStackFrame next() {
        XPathContextMajor context = next;
        if (context == null) {
            return null;
        }
        int construct = context.getOriginatingConstructType();
        Object origin = context.getOrigin();

        if (construct == Location.CONTROLLER) {
            next = getMajorCaller(context);
            return new ContextStackFrame.CallingApplication();
        } else if (construct == Location.BUILT_IN_TEMPLATE) {
            next = getMajorCaller(context);
            return new ContextStackFrame.BuiltInTemplateRule();
        }
        if (construct == Location.FUNCTION_CALL) {
            ContextStackFrame.FunctionCall sf = new ContextStackFrame.FunctionCall();
            UserFunctionCall ufc = (UserFunctionCall)origin;
            sf.setSystemId(ufc.getSystemId());
            sf.setLineNumber(-1); //(ufc.getLineNumber());
            sf.setContainer(ufc.getContainer());
            sf.setFunctionName(ufc.getFunctionName());
            sf.setContextItem(context.getContextItem());
            next = getMajorCaller(context);
            return sf;
        } else if (construct == StandardNames.XSL_APPLY_TEMPLATES) {
            ContextStackFrame.ApplyTemplates sf = new ContextStackFrame.ApplyTemplates();
            ApplyTemplates loc = (ApplyTemplates)origin;
            sf.setSystemId(loc.getSystemId());
            sf.setLineNumber(-1); //(loc.getLineNumber());
            sf.setContainer(loc.getContainer());
            sf.setContextItem(context.getContextItem());
            next = getMajorCaller(context);
            return sf;
        } else if (construct == StandardNames.XSL_CALL_TEMPLATE) {
            ContextStackFrame.CallTemplate sf = new ContextStackFrame.CallTemplate();
            CallTemplate loc = (CallTemplate)origin;
            sf.setSystemId(loc.getSystemId());
            sf.setLineNumber(-1); //(loc.getLineNumber());
            sf.setContainer(loc.getContainer());
            sf.setTemplateName(loc.getObjectName());
            sf.setContextItem(context.getContextItem());
            next = getMajorCaller(context);
            return sf;
        } else if (construct == StandardNames.XSL_VARIABLE) {
            ContextStackFrame.VariableEvaluation sf = new ContextStackFrame.VariableEvaluation();
            GeneralVariable var = ((GeneralVariable)origin);
            sf.setSystemId(var.getSystemId());
            sf.setLineNumber(-1); //(var.getLineNumber());
            sf.setContainer(var.getContainer());
            sf.setContextItem(context.getContextItem());
            sf.setVariableName(var.getVariableQName());
            next = getMajorCaller(context);
            return sf;
        } else {
            //other context changes are not considered significant enough to report
View Full Code Here

                throw new XPathException("Stylesheet has not been compiled");
            }

            openMessageEmitter();

            XPathContextMajor initialContext = newXPathContext();

            if (source != null) {

                initialContextItem = source;
                contextForGlobalVariables = source.getRoot();

                SequenceIterator currentIter = SingletonIterator.makeIterator(source);
                if (initialTemplate != null) {
                    currentIter.next();
                }
                initialContext.setCurrentIterator(currentIter);
            }

            initializeController();

            PipelineConfiguration pipe = makePipelineConfiguration();
            Receiver result = openResult(pipe, initialContext, target, ResultDocument.APPEND_CONTENT);

            // Process the source document by applying template rules to the initial context node

            if (initialTemplate == null) {
                initialContextItem = source;
                Mode mode = getRuleManager().getMode(initialMode, false);
                if (mode == null || (initialMode != null && mode.isEmpty())) {
                    throw new XPathException("Requested initial mode " +
                            (initialMode == null ? "" : initialMode.getDisplayName()) +
                            " does not exist", "XTDE0045");
                }
                TailCall tc = ApplyTemplates.applyTemplates(
                                    initialContext.getCurrentIterator(),
                                    mode,
                                    null, null, initialContext, null);
                while (tc != null) {
                    tc = tc.processLeavingTail();
                }
            } else {
                Template t = initialTemplate;
                XPathContextMajor c2 = initialContext.newContext();
                c2.openStackFrame(t.getStackFrameMap());
                c2.setLocalParameters(new ParameterSet());
                c2.setTunnelParameters(new ParameterSet());

                TailCall tc = t.expand(c2);
                while (tc != null) {
                    tc = tc.processLeavingTail();
                }
View Full Code Here

     *
     * @return the new XPathContext
     */

    public XPathContextMajor newXPathContext() {
        return new XPathContextMajor(this);
    }
View Full Code Here

            // clear all the local variables: they are no longer needed
            Arrays.fill(context.getStackFrame().getStackFrameValues(), null);
            return new NextMatchPackage(rule, params, tunnels, context);
        } else {
            Template nh = rule.getAction();
            XPathContextMajor c2 = context.newContext();
            c2.openStackFrame(nh.getStackFrameMap());
            c2.setLocalParameters(params);
            c2.setTunnelParameters(tunnels);
            c2.setCurrentTemplateRule(rule);
            nh.apply(c2);
        }
        return null;
    }
View Full Code Here

TOP

Related Classes of client.net.sf.saxon.ce.expr.XPathContextMajor

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.