Class StandaloneContext

  • All Implemented Interfaces:
    StaticContext

    public class StandaloneContext
    extends Object
    implements StaticContext
    A StandaloneContext provides a context for parsing an expression or pattern appearing in a context other than a stylesheet.
    • Constructor Detail

      • StandaloneContext

        public StandaloneContext()
        Create a StandaloneContext using the default NamePool
      • StandaloneContext

        public StandaloneContext​(NamePool pool)
        Create a StandaloneContext using a specific NamePool
    • Method Detail

      • declareNamespace

        public void declareNamespace​(String prefix,
                                     String uri)
        Declare a namespace whose prefix can be used in expressions
      • getSystemId

        public String getSystemId()
        Get the system ID of the container of the expression
        Specified by:
        getSystemId in interface StaticContext
        Returns:
        "" always
      • getBaseURI

        public String getBaseURI()
        Get the Base URI of the stylesheet element, for resolving any relative URI's used in the expression. Used by the document() function.
        Specified by:
        getBaseURI in interface StaticContext
        Returns:
        "" always
      • getLineNumber

        public int getLineNumber()
        Get the line number of the expression within that container
        Specified by:
        getLineNumber in interface StaticContext
        Returns:
        -1 always
      • makeNameCode

        public final int makeNameCode​(String qname,
                                      boolean useDefault)
                               throws XPathException
        Make a NameCode, using this Element as the context for namespace resolution
        Specified by:
        makeNameCode in interface StaticContext
        Parameters:
        qname - The name as written, in the form "[prefix:]localname"
        Throws:
        XPathException
      • getFingerprint

        public final int getFingerprint​(String qname,
                                        boolean useDefault)
                                 throws XPathException
        Make a fingerprint, using this Element as the context for namespace resolution
        Specified by:
        getFingerprint in interface StaticContext
        Parameters:
        qname - The name as written, in the form "[prefix:]localname"
        Returns:
        -1 if the name is not already present in the name pool
        Throws:
        XPathException
      • bindVariable

        public Binding bindVariable​(int fingerprint)
                             throws XPathException
        Bind a variable used in this element to the XSLVariable element in which it is declared
        Specified by:
        bindVariable in interface StaticContext
        Parameters:
        fingerprint - The fingerprint of the variable name
        Returns:
        a Binding object that can be used to identify it in the Bindery
        Throws:
        XPathException - if the variable has not been declared, or if the context does not allow the use of variables
      • isExtensionNamespace

        public boolean isExtensionNamespace​(short uriCode)
        Determine whether a given URI identifies an extension element namespace
        Specified by:
        isExtensionNamespace in interface StaticContext
      • getExternalJavaClass

        public Class getExternalJavaClass​(String uri)
        Get an external Java class corresponding to a given namespace prefix, if there is one.
        Specified by:
        getExternalJavaClass in interface StaticContext
        Parameters:
        uri - The namespace URI corresponding to the prefix used in the function call.
        Returns:
        the Java class name if a suitable class exists, otherwise return null. This implementation always returns null.
      • allowsKeyFunction

        public boolean allowsKeyFunction()
        Determine whether the key() function is permmitted in this context
        Specified by:
        allowsKeyFunction in interface StaticContext
      • getVersion

        public String getVersion()
        Get the effective XSLT version in this region of the stylesheet
        Specified by:
        getVersion in interface StaticContext