All Downloads are FREE. Search and download functionalities are using the official Maven repository.

net.sf.saxon.style.SaxonScript Maven / Gradle / Ivy

package net.sf.saxon.style;
import net.sf.saxon.expr.Expression;
import net.sf.saxon.instruct.Executable;
import net.sf.saxon.om.AttributeCollection;
import net.sf.saxon.om.StandardNames;
import net.sf.saxon.trans.SaxonErrorCode;
import net.sf.saxon.trans.XPathException;
import net.sf.saxon.value.Whitespace;

import java.net.MalformedURLException;
import java.net.URL;
import java.net.URLClassLoader;
import java.util.StringTokenizer;

/**
* A saxon:script element in the stylesheet.
*/

public class SaxonScript extends StyleElement {

    private Class javaClass = null;
    private String implementsURI = null;
    private String language = null;

    public void prepareAttributes() throws XPathException {

	    String languageAtt = null;
	    String implementsAtt = null;
	    String srcAtt = null;
	    String archiveAtt = null;

		AttributeCollection atts = getAttributeList();

		for (int a=0; a1 ? "s" : ""));
                } catch (java.lang.NoClassDefFoundError err2) {
                    compileError("Cannot use the archive attribute with this Java VM");
                }
            }
        } else {
            // language != java
            compileError("The only language supported for Saxon extension functions is 'java'");
        }
        getPrincipalStylesheet().declareJavaClass(implementsURI, javaClass);
    }

    public void validate() throws XPathException {
        checkTopLevel(null);
    }

    public Expression compile(Executable exec) throws XPathException {
        return null;
    }


    /**
    * Get the Java class, if this saxon:script element matches the specified URI.
    * Otherwise return null
    */

//    private Class getJavaClass(String uri) {
//        if (language==null) {
//            // allow for forwards references, but don't bother reporting
//            // any errors; that will happen when the element is processed
//            // in its own right.
//            try {
//                prepareAttributes();
//            } catch (TransformerConfigurationException e) {
//                return null;
//            }
//        }
//        if (language.equals("java") && implementsURI.equals(uri)) {
//            return javaClass;
//        } else {
//            return null;
//        }
//    }

}

//
// The contents of this file are subject to the Mozilla Public License Version 1.0 (the "License");
// you may not use this file except in compliance with the License. You may obtain a copy of the
// License at http://www.mozilla.org/MPL/
//
// Software distributed under the License is distributed on an "AS IS" basis,
// WITHOUT WARRANTY OF ANY KIND, either express or implied.
// See the License for the specific language governing rights and limitations under the License.
//
// The Original Code is: all this file.
//
// The Initial Developer of the Original Code is Michael H. Kay.
//
// Portions created by (your name) are Copyright (C) (your legal entity). All Rights Reserved.
//
// Contributor(s): none.
//





© 2015 - 2025 Weber Informatics LLC | Privacy Policy