Class ExpressionContext

  • All Implemented Interfaces:
    Direct Known Subclasses:

    public class ExpressionContext
    extends java.lang.Object
    implements StaticContext
    An ExpressionContext represents the context for an XPath expression written in the stylesheet.
    • Constructor Detail

      • ExpressionContext

        public ExpressionContext​(StyleElement styleElement,
                                 StructuredQName attributeName)
        Create a static context for XPath expressions in an XSLT stylesheet
        styleElement - the element on which the XPath expression appears
        attributeName - the name of the attribute in which the XPath expression appears; or null if the expression appears in a text node
    • Method Detail

      • isSchemaAware

        public boolean isSchemaAware()
        Ask whether expressions compiled under this static context are schema-aware. They must be schema-aware if the expression is to handle typed (validated) nodes
        true if expressions are schema-aware
      • makeEarlyEvaluationContext

        public XPathContext makeEarlyEvaluationContext()
        Construct a dynamic context for early evaluation of constant subexpressions
        Specified by:
        makeEarlyEvaluationContext in interface StaticContext
        a newly constructed dynamic context
      • makeRetainedStaticContext

        public RetainedStaticContext makeRetainedStaticContext()
        Construct a RetainedStaticContext, which extracts information from this StaticContext to provide the subset of static context information that is potentially needed during expression evaluation
        Specified by:
        makeRetainedStaticContext in interface StaticContext
        a RetainedStaticContext object: either a newly created one, or one that is reused from a previous invocation.
      • getContainingLocation

        public Location getContainingLocation()
        Get the containing location of an XPath expression within the stylesheet
        Specified by:
        getContainingLocation in interface StaticContext
        a Location that identifies the containing element, together with the name of the attribute holding the XPath expression in question.
      • issueWarning

        public void issueWarning​(java.lang.String s,
                                 Location locator)
        Issue a compile-time warning
        Specified by:
        issueWarning in interface StaticContext
        s - The warning message. This should not contain any prefix such as "Warning".
        locator - the location of the construct in question. May be null.
      • getSystemId

        public java.lang.String getSystemId()
        Get the System ID of the entity containing the expression (used for diagnostics)
        Specified by:
        getSystemId in interface StaticContext
        the system ID
      • getStaticBaseURI

        public java.lang.String getStaticBaseURI()
        Get the Base URI of the element containing the expression, for resolving any relative URI's used in the expression. Used by the document() function.
        Specified by:
        getStaticBaseURI in interface StaticContext
        the static base URI, or null if not known
      • getRequiredContextItemType

        public ItemType getRequiredContextItemType()
        Get the required type of the context item. If no type has been explicitly declared for the context item, an instance of AnyItemType (representing the type item()) is returned.
        Specified by:
        getRequiredContextItemType in interface StaticContext
        the required type of the context item
      • getDecimalFormatManager

        public DecimalFormatManager getDecimalFormatManager()
        Get a DecimalFormatManager to resolve the names of decimal formats used in calls to the format-number() function.
        Specified by:
        getDecimalFormatManager in interface StaticContext
        the decimal format manager for this static context, or null if named decimal formats are not supported in this environment.
      • bindVariable

        public Expression bindVariable​(StructuredQName qName)
                                throws XPathException
        Bind a variable to an object that can be used to refer to it
        Specified by:
        bindVariable in interface StaticContext
        qName - the name of the variable
        a VariableDeclaration object that can be used to identify it in the Bindery,
        XPathException - if the variable has not been declared
      • getFunctionLibrary

        public FunctionLibrary getFunctionLibrary()
        Get the function library containing all the in-scope functions available in this static context
        Specified by:
        getFunctionLibrary in interface StaticContext
        the function library
      • getDefaultCollationName

        public java.lang.String getDefaultCollationName()
        Get the default collation. Return null if no default collation has been defined
        Specified by:
        getDefaultCollationName in interface StaticContext
        the name of the default collation; or the name of the codepoint collation if no default collation has been defined
      • getDefaultElementNamespace

        public java.lang.String getDefaultElementNamespace()
        Get the default XPath namespace for elements and types Return NamespaceConstant.NULL for the non-namespace
        Specified by:
        getDefaultElementNamespace in interface StaticContext
        the default namespace, or NamespaceConstant.NULL for the non-namespace
      • getDefaultFunctionNamespace

        public java.lang.String getDefaultFunctionNamespace()
        Get the default function namespace
        Specified by:
        getDefaultFunctionNamespace in interface StaticContext
        the default namespace for function names
      • isInBackwardsCompatibleMode

        public boolean isInBackwardsCompatibleMode()
        Determine whether Backwards Compatible Mode is used
        Specified by:
        isInBackwardsCompatibleMode in interface StaticContext
        true if 1.0 compaibility mode is in force.
      • getXPathVersion

        public int getXPathVersion()
        Get the XPath language level supported, as an integer (being the actual version number times ten). In Saxon 9.9, for XSLT, the possible values are 30 (XPath 3.0), 31 (XPath 3.1), and 305 (XPath 3.0 plus the extensions defined in XSLT 3.0).
        Specified by:
        getXPathVersion in interface StaticContext
        the XPath language level; the return value will be either 31 or 40
      • isImportedSchema

        public boolean isImportedSchema​(java.lang.String namespace)
        Test whether a schema has been imported for a given namespace
        Specified by:
        isImportedSchema in interface StaticContext
        namespace - the target namespace of the required schema
        true if a schema for this namespace has been imported
      • getImportedSchemaNamespaces

        public java.util.Set<java.lang.String> getImportedSchemaNamespaces()
        Get the set of imported schemas
        Specified by:
        getImportedSchemaNamespaces in interface StaticContext
        a Set, the set of URIs representing the names of imported schemas
      • getKeyManager

        public KeyManager getKeyManager()
        Get the KeyManager, containing definitions of keys available for use.
        Specified by:
        getKeyManager in interface StaticContext
        the KeyManager. This is used to resolve key names, both explicit calls on key() used in XSLT, and system-generated calls on key() which may also appear in XQuery and XPath
      • getStyleElement

        public StyleElement getStyleElement()
        Get the stylesheet element containing this XPath expression
        the element in the tree representation of the source stylesheet
      • resolveTypeAlias

        public ItemType resolveTypeAlias​(StructuredQName typeName)
        Get type alias. This is a Saxon extension. A type alias is a QName which can be used as a shorthand for an itemtype, using the syntax ~typename anywhere that an item type is permitted.
        Specified by:
        resolveTypeAlias in interface StaticContext
        typeName - the name of the type alias
        the corresponding item type, if the name is recognised; otherwise null.