Examples of PreparedStylesheet


Examples of net.sf.saxon.PreparedStylesheet

    protected void issueWarning(TransformerException error) {
        if (error.getLocator() == null) {
            error.setLocator(this);
        }
        PreparedStylesheet pss = getPreparedStylesheet();
        if (pss != null) {
            // it is null before the stylesheet has been fully built - ignore it
            pss.reportWarning(error);
        }
    }
View Full Code Here

Examples of net.sf.saxon.PreparedStylesheet

    public void compileStylesheet() throws XPathException {

        try {

            PreparedStylesheet pss = getPreparedStylesheet();
            // If any XQuery functions were imported, fix up all function calls
            // registered against these functions.
            try {
                //queryFunctions.bindUnboundFunctionCalls();
                Iterator qf = queryFunctions.getFunctionDefinitions();
                while (qf.hasNext()) {
                    XQueryFunction f = (XQueryFunction) qf.next();
                    f.fixupReferences(getStaticContext());
                }
            } catch (XPathException e) {
                compileError(e);
            }

            // Call compile method for each top-level object in the stylesheet

            for (int i = 0; i < topLevel.size(); i++) {
                NodeInfo node = (NodeInfo) topLevel.get(i);
                if (node instanceof StyleElement) {
                    StyleElement snode = (StyleElement) node;
                    //int module = putModuleNumber(snode.getSystemId());
                    Expression inst = snode.compile(exec);
                    if (inst != null) {
                        inst.setLocationId(allocateLocationId(getSystemId(), snode.getLineNumber()));
                    }
                }
            }

            // Call optimize method for each top-level object in the stylesheet

            for (int i = 0; i < topLevel.size(); i++) {
                NodeInfo node = (NodeInfo) topLevel.get(i);
                if (node instanceof StylesheetProcedure) {
                    ((StylesheetProcedure) node).optimize();
                }
            }

            // Fix up references to the default default decimal format

            if (pss.getDecimalFormatManager() != null) {
                try {
                    pss.getDecimalFormatManager().fixupDefaultDefault();
                } catch (XPathException err) {
                    compileError(err.getMessage(), err.getErrorCodeQName());
                }
            }
View Full Code Here

Examples of net.sf.saxon.PreparedStylesheet

     * on the standard error output.
     */

    public XsltExecutable compile(Source source) throws SaxonApiException {
        try {
            PreparedStylesheet pss = PreparedStylesheet.compile(source, config, compilerInfo);
            return new XsltExecutable(processor, pss);
        } catch (TransformerConfigurationException e) {
            throw new SaxonApiException(e);
        }
    }
View Full Code Here

Examples of net.sf.saxon.PreparedStylesheet

        // Set the location of the error if there is not current location information,
        // or if the current location information is local to the XPath expression
        if (error.getLocator()==null || error.getLocator() instanceof ExpressionLocation) {
            error.setLocator(this);
        }
        PreparedStylesheet pss = getPreparedStylesheet();
        try {
            if (pss==null) {
                // it is null before the stylesheet has been fully built
                throw error;
            } else {
                pss.reportError(error);
            }
        } catch (TransformerException err2) {
            if (err2 instanceof TransformerConfigurationException) {
                throw (TransformerConfigurationException)err2;
            }
View Full Code Here

Examples of net.sf.saxon.PreparedStylesheet

    protected void compileWarning(String message)
    throws TransformerConfigurationException {
        TransformerConfigurationException tce =
            new TransformerConfigurationException(message);
        tce.setLocator(this);
        PreparedStylesheet pss = getPreparedStylesheet();
        if (pss!=null) {
            pss.reportWarning(tce);
        }
    }
View Full Code Here

Examples of net.sf.saxon.PreparedStylesheet

    protected void issueWarning(TransformerException error) {
        if (error.getLocator()==null) {
            error.setLocator(this);
        }
        PreparedStylesheet pss = getPreparedStylesheet();
        if (pss!=null) {
            // it is null before the stylesheet has been fully built - ignore it
            pss.reportWarning(error);
        }
    }
View Full Code Here

Examples of net.sf.saxon.PreparedStylesheet

        checkEmpty();
        checkTopLevel((this instanceof XSLInclude ? "XT0170" : "XT0190"));

        try {
            XSLStylesheet thisSheet = (XSLStylesheet)getParentNode();
            PreparedStylesheet pss = getPreparedStylesheet();
            Configuration config = pss.getConfiguration();

            // System.err.println("GeneralIncorporate: href=" + href + " base=" + getBaseURI());
            Source source = config.getURIResolver().resolve(href, getBaseURI());

            // if a user URI resolver returns null, try the standard one
            // (Note, the standard URI resolver never returns null)
            if (source==null) {
                source = (new StandardURIResolver(config)).resolve(href, getBaseURI());
            }

            if (source instanceof NodeInfo) {
                if (source instanceof Node) {
                    source = new DOMSource((Node)source);
                } else {
                    throw new DynamicError("URIResolver must not return a " + source.getClass());
                }
            }

            // check for recursion

            XSLStylesheet anc = thisSheet;

            if (source.getSystemId() != null) {
                while(anc!=null) {
                    if (source.getSystemId().equals(anc.getSystemId())) {
                        compileError("A stylesheet cannot " + getLocalPart() + " itself",
                                (this instanceof XSLInclude ? "XT0180" : "XT0210"));
                        return null;
                    }
                    anc = anc.getImporter();
                }
            }

            StyleNodeFactory snFactory = new StyleNodeFactory(getNamePool(),
                                        config.isAllowExternalFunctions());
            includedDoc = pss.loadStylesheetModule(source, config, getNamePool(), snFactory);

            // allow the included document to use "Literal Result Element as Stylesheet" syntax

            ElementImpl outermost = (ElementImpl)includedDoc.getDocumentElement();
View Full Code Here

Examples of net.sf.saxon.PreparedStylesheet

                File styleFile = ((FileResource) stylesheet).getFile();
                CompilerInfo info = new CompilerInfo();
                info.setURIResolver(config.getURIResolver());
                info.setErrorListener(config.getErrorListener());
                info.setCompileWithTracing(config.isCompileWithTracing());
                PreparedStylesheet pss = PreparedStylesheet.compile(new StreamSource(styleFile), config, info);
                transformer = (Controller)pss.newTransformer();
                transformer.setInitialMode(initialMode);
                transformer.setInitialTemplate(initialTemplate);
                if (tracing) {
                    transformer.addTraceListener(new XSLTTraceListener());
                }
View Full Code Here

Examples of net.sf.saxon.PreparedStylesheet

        // Set the location of the error if there is not current location information,
        // or if the current location information is local to the XPath expression
        if (error.getLocator() == null || error.getLocator() instanceof ExpressionLocation) {
            error.setLocator(this);
        }
        PreparedStylesheet pss = getPreparedStylesheet();
        try {
            if (pss == null) {
                // it is null before the stylesheet has been fully built
                throw error;
            } else {
                pss.reportError(error);
            }
        } catch (TransformerException err2) {
            if (err2.getLocator() == null) {
                err2.setLocator(this);
            }
View Full Code Here

Examples of net.sf.saxon.PreparedStylesheet

    protected void compileWarning(String message, String errorCode)
            throws XPathException {
        XPathException tce = new XPathException(message);
        tce.setErrorCode(errorCode);
        tce.setLocator(this);
        PreparedStylesheet pss = getPreparedStylesheet();
        if (pss != null) {
            pss.reportWarning(tce);
        }
    }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.