Class XSLStylesheet

    • Constructor Detail

      • XSLStylesheet

        public XSLStylesheet()
    • Method Detail

      • setPreparedStylesheet

        public void setPreparedStylesheet​(PreparedStylesheet sheet)
        Create link to the owning PreparedStylesheet object
      • getFunctionLibrary

        public FunctionLibrary getFunctionLibrary()
        Get the function library. Available only on the principal stylesheet module
      • getLocationMap

        public LocationMap getLocationMap()
        Get the locationMap object
      • getTargetNamePool

        public NamePool getTargetNamePool()
        Get the namepool to be used at run-time, this namepool holds the names used in all XPath expressions and patterns
        Overrides:
        getTargetNamePool in class StyleElement
      • getRuleManager

        public RuleManager getRuleManager()
        Get the RuleManager which handles template rules
      • getStripperRules

        protected Mode getStripperRules()
        Get the rules determining which nodes are to be stripped from the tree
      • stripsWhitespace

        public boolean stripsWhitespace()
        Determine whether this stylesheet does any whitespace stripping
      • getKeyManager

        public KeyManager getKeyManager()
        Get the KeyManager which handles key definitions
      • getDecimalFormatManager

        public DecimalFormatManager getDecimalFormatManager()
        Get the DecimalFormatManager which handles decimal-format definitions
      • getCollationMap

        public CollationMap getCollationMap()
        Get the collation map
      • setCollation

        public void setCollation​(java.lang.String name,
                                 java.util.Comparator collation)
        Register a named collation (actually a Comparator)
      • findCollation

        protected java.util.Comparator findCollation​(java.lang.String name)
        Find a named collation. Note this method should only be used at compile-time, before declarations have been pre-processed. After that time, use getCollation().
        Parameters:
        name - identifies the name of the collation required; null indicates that the default collation is required
        Returns:
        null if the collation is not found
      • getCharacterMap

        public XSLCharacterMap getCharacterMap​(int fingerprint)
        Get a character map, identified by the fingerprint of its name. Search backwards through the stylesheet.
        Parameters:
        fingerprint - The fingerprint of the character map name, in the target namepool.
        Returns:
        the identified character map, or null if not found
      • setPrecedence

        public void setPrecedence​(int prec)
        Set the import precedence of this stylesheet
      • getPrecedence

        public int getPrecedence()
        Get the import precedence of this stylesheet
        Overrides:
        getPrecedence in class StyleElement
      • getMinImportPrecedence

        public int getMinImportPrecedence()
        Get the minimum import precedence of this stylesheet, that is, the lowest precedence of any stylesheet imported by this one
      • setMinImportPrecedence

        public void setMinImportPrecedence​(int precedence)
        Set the minimum import precedence of this stylesheet, that is, the lowest precedence of any stylesheet imported by this one
      • setImporter

        public void setImporter​(XSLStylesheet importer)
        Set the StyleSheet that included or imported this one.
      • getImporter

        public XSLStylesheet getImporter()
        Get the StyleSheet that included or imported this one.
        Returns:
        null if this is the principal stylesheet
      • setWasIncluded

        public void setWasIncluded()
        Indicate that this stylesheet was included (by its "importer") using an xsl:include statement as distinct from xsl:import
      • getTopLevel

        public java.util.List getTopLevel()
        Get the top level elements in this stylesheet, after applying include/import
      • allocateGlobalSlot

        public int allocateGlobalSlot​(int fingerprint)
        Allocate a slot number for a global variable or parameter
      • allocatePatternSlots

        public void allocatePatternSlots​(int n)
        Ensure there is enough space for local variables or parameters when evaluating the match pattern of template rules
      • getDefaultValidation

        public int getDefaultValidation()
        Get the value of the default validation attribute
      • getInputTypeAnnotations

        public int getInputTypeAnnotations()
        Get the value of the input-type-annotations attribute, for this module combined with that of all included/imported modules. The value is an or-ed combination of the two bits ANNOTATION_STRIP and ANNOTATION_PRESERVE
      • setInputTypeAnnotations

        public void setInputTypeAnnotations​(int annotations)
                                     throws XPathException
        Set the value of the input-type-annotations attribute, for this module combined with that of all included/imported modules. The value is an or-ed combination of the two bits ANNOTATION_STRIP and ANNOTATION_PRESERVE
        Throws:
        XPathException
      • allowsAllBuiltInTypes

        public boolean allowsAllBuiltInTypes()
        Determine whether the use of non-primitive built-in types has been enabled for this stylesheet (This is relevant only for Saxon-B: such types are always permitted in Saxon-SA)
      • getNamespaceAlias

        protected int getNamespaceAlias​(short uriCode)
        Get the declared namespace alias for a given namespace URI code if there is one. If there is more than one, we get the last.
        Parameters:
        uriCode - The code of the uri used in the stylesheet.
        Returns:
        The namespace code to be used (prefix in top half, uri in bottom half): return -1 if no alias is defined
      • isAliasResultNamespace

        protected boolean isAliasResultNamespace​(short uriCode)
        Determine if a namespace is included in the result-prefix of a namespace-alias
      • preprocess

        public void preprocess()
                        throws XPathException
        Preprocess does all the processing possible before the source document is available. It is done once per stylesheet, so the stylesheet can be reused for multiple source documents. The method is called only on the XSLStylesheet element representing the principal stylesheet module
        Throws:
        XPathException
      • hasNamespaceAliases

        protected boolean hasNamespaceAliases()
      • getGlobalVariable

        public XSLVariableDeclaration getGlobalVariable​(int fingerprint)
        Get the global variable or parameter with a given fingerprint (taking precedence rules into account)
      • setNeedsDynamicOutputProperties

        public void setNeedsDynamicOutputProperties​(boolean b)
        Set that this stylesheet needs dynamic output properties
      • gatherOutputProperties

        public java.util.Properties gatherOutputProperties​(int fingerprint)
                                                    throws XPathException
        Create an output properties object representing the xsl:output elements in the stylesheet.
        Parameters:
        fingerprint - The name of the output format required. If set to -1, gathers information for the unnamed output format
        Returns:
        the Properties object containing the details of the specified output format
        Throws:
        XPathException - if a named output format does not exist in the stylesheet
      • declareJavaClass

        protected void declareJavaClass​(java.lang.String uri,
                                        java.lang.Class theClass)
        Declare a URI that maps to a Java class containing extension functions
      • isImportedSchema

        protected boolean isImportedSchema​(java.lang.String targetNamespace)
        Get an imported schema with a given namespace
        Parameters:
        targetNamespace - The target namespace of the required schema. Supply an empty string for the default namespace
        Returns:
        the required Schema, or null if no such schema has been imported
      • addImportedSchema

        protected void addImportedSchema​(java.lang.String targetNamespace)
      • getImportedSchemaTable

        protected java.util.HashSet getImportedSchemaTable()
      • compile

        public Expression compile​(Executable exec)
        Dummy compile() method to satisfy the interface
        Specified by:
        compile in class StyleElement
        Returns:
        either a ComputedExpression, or null. The value null is returned when compiling an instruction that returns a no-op, or when compiling a top-level object such as an xsl:template that compiles into something other than an instruction.