## net.sf.saxon.style
Class XSLStylesheet

    java.lang.Object
      net.sf.saxon.tree.NodeImpl
          net.sf.saxon.tree.ElementImpl
              net.sf.saxon.tree.ElementWithAttributes
                  net.sf.saxon.style.StyleElement
                      net.sf.saxon.style.XSLStylesheet

All Implemented Interfaces:
  Source, SourceLocator, LocationProvider, SaxonLocator, Container, FingerprintedNode, Item, NodeInfo, ValueRepresentation, InstructionInfo, Locator

    public class XSLStylesheet

extends StyleElement

An xsl:stylesheet or xsl:transform element in the stylesheet.
Note this element represents a stylesheet module, not necessarily the whole stylesheet. However, much of the functionality (and the fields) are relevant only to the top-level module.

Field Summary
`static int` `ANNOTATION_PRESERVE`
`static int` `ANNOTATION_STRIP`

Fields inherited from class net.sf.saxon.style.StyleElement
`REPORT_ALWAYS, REPORT_IF_INSTANTIATED, REPORT_UNLESS_FALLBACK_AVAILABLE, REPORT_UNLESS_FORWARDS_COMPATIBLE`

Fields inherited from class net.sf.saxon.tree.NodeImpl
`NODE_LETTER`

Fields inherited from interface net.sf.saxon.om.NodeInfo
`ALL_NAMESPACES, EMPTY_NAMESPACE_LIST, IS_DTD_TYPE, IS_NILLED, LOCAL_NAMESPACES, NO_NAMESPACES`

Fields inherited from interface net.sf.saxon.om.ValueRepresentation
`EMPTY_VALUE_ARRAY`

Constructor Summary
`XSLStylesheet()`

Method Summary
`void` `addChild(NodeImpl node, int index)` Add a child node to this node.
`int` `allocateGlobalSlot(int fingerprint)` Allocate a slot number for a global variable or parameter
`void` `allocatePatternSlots(int n)` Ensure there is enough space for local variables or parameters when evaluating the match pattern of template rules
`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)
`void` `compact(int size)` Compact the space used by this node
`Expression` `compile(Executable exec)` Dummy compile() method to satisfy the interface
`Executable` `compileStylesheet()` Compile the stylesheet to create an executable.
`AxisIterator` `enumerateChildren(NodeTest test)` Get an enumeration of the children of this node
`Properties` `gatherOutputProperties(int fingerprint)` Create an output properties object representing the xsl:output elements in the stylesheet.
`XSLCharacterMap` `getCharacterMap(int fingerprint)` Get a character map, identified by the fingerprint of its name.
`CollationMap` `getCollationMap()` Get the collation map
`DecimalFormatManager` `getDecimalFormatManager()` Get the DecimalFormatManager which handles decimal-format definitions
`String` `getDefaultCollationName()` Get the name of the default collation
`int` `getDefaultValidation()` Get the value of the default validation attribute
`Executable` `getExecutable()` Get the run-time Executable object
`NodeInfo` `getFirstChild()` Get the first child node of the element
`FunctionLibrary` `getFunctionLibrary()` Get the function library.
`XSLVariableDeclaration` `getGlobalVariable(int fingerprint)` Get the global variable or parameter with a given fingerprint (taking precedence rules into account)
`XSLStylesheet` `getImporter()` Get the StyleSheet that included or imported this one.
`int` `getInputTypeAnnotations()` Get the value of the input-type-annotations attribute, for this module combined with that of all included/imported modules.
`int` `getInputTypeAnnotationsAttribute()` Get the value of the input-type-annotations attribute, for this module alone.
`KeyManager` `getKeyManager()` Get the KeyManager which handles key definitions
`NodeInfo` `getLastChild()` Get the last child node of the element
`LocationMap` `getLocationMap()` Get the locationMap object
`int` `getMinImportPrecedence()` Get the minimum import precedence of this stylesheet, that is, the lowest precedence of any stylesheet imported by this one
`int` `getPrecedence()` Get the import precedence of this stylesheet
`PreparedStylesheet` `getPreparedStylesheet()` Get the owning PreparedStylesheet object
`RuleManager` `getRuleManager()` Get the RuleManager which handles template rules
`String` `getStringValue()` Return the string-value of the node, that is, the concatenation of the character content of all descendent elements and text nodes.
`CharSequence` `getStringValueCS()` Get the value of the item as a CharSequence.
`NamePool` `getTargetNamePool()` Get the namepool to be used at run-time, this namepool holds the names used in all XPath expressions and patterns
`List` `getTopLevel()` Get the top level elements in this stylesheet, after applying include/import
`boolean` `hasChildNodes()` Determine if the node has any children.
`void` `prepareAttributes()` Prepare the attributes on the stylesheet element
`void` `preprocess()` Preprocess does all the processing possible before the source document is available.
`void` `processAllAttributes()` Process the attributes of every node in the stylesheet
`void` `setCollation(String name, StringCollator collation)` Register a named collation (actually a StringCollator)
`void` `setImporter(XSLStylesheet importer)` Set the StyleSheet that included or imported this one.
`void` `setInputTypeAnnotations(int annotations)` Set the value of the input-type-annotations attribute, for this module combined with that of all included/imported modules.
`void` `setMinImportPrecedence(int precedence)` Set the minimum import precedence of this stylesheet, that is, the lowest precedence of any stylesheet imported by this one
`void` `setNeedsDynamicOutputProperties(boolean b)` Set that this stylesheet needs dynamic output properties
`void` `setPrecedence(int prec)` Set the import precedence of this stylesheet
`void` `setPreparedStylesheet(PreparedStylesheet sheet)` Create link to the owning PreparedStylesheet object
`void` `setWasIncluded()` Indicate that this stylesheet was included (by its "importer") using an xsl:include statement as distinct from xsl:import
`void` `spliceIncludes()` Process xsl:include and xsl:import elements.
`boolean` `stripsWhitespace()` Determine whether this stylesheet does any whitespace stripping
`void` `useChildrenArray(NodeImpl[] array)` Supply an array to be used for the array of children.
`void` `validate()` Validate this element

Methods inherited from class net.sf.saxon.style.StyleElement

`allocateLocationId, allocatePatternSlots, allocateSlots, allocateSlots, backwardsCompatibleModeIsEnabled, bindVariable, checkEmpty, checkTopLevel, checkWithinTemplate, compileSequenceConstructor, fixupReferences, forwardsCompatibleModeIsEnabled, getAttributeValue, getConstructType, getContainingSlotManager, getContainingStylesheet, getHostLanguage, getLineNumber, getLineNumber, getLocationProvider, getNamespaceResolver, getObjectFingerprint, getObjectNameCode, getProperties, getProperty, getSchemaType, getStaticContext, getStylesheetFunction, getSystemId, getTypeAnnotation, getVersion, isExcludedNamespace, isExtensionNamespace, isInstruction, isTopLevel, makeAttributeValueTemplate, makeExpression, makeNameCode, makeNamespaceContext, makePattern, makeSequenceType, markTailCalls, mayContainFallback, mayContainSequenceConstructor, postValidate, processAttributes, replaceSubExpression, reportAbsence, setLineNumber, setObjectNameCode, substituteFor, typeCheck, typeCheck, validateSubtree`

Methods inherited from class net.sf.saxon.tree.ElementWithAttributes
`copy, getAttributeList, getAttributeValue, getDeclaredNamespaces, getInScopeNamespaceCodes, getPrefixForURI, getURICodeForPrefix, getURIForPrefix, initialise, iteratePrefixes, sendNamespaceDeclarations, setNamespaceDeclarations`

Methods inherited from class net.sf.saxon.tree.ElementImpl
`generateId, getBaseURI, getDocumentRoot, getNameCode, getNodeKind, getRoot, getSystemId, setNameCode, setSystemId`

Methods inherited from class net.sf.saxon.tree.NodeImpl
`atomize, compareOrder, equals, getColumnNumber, getConfiguration, getDisplayName, getDocumentNumber, getFingerprint, getLocalPart, getNamePool, getNextInDocument, getNextSibling, getParent, getPrefix, getPreviousInDocument, getPreviousSibling, getPublicId, getTypeAnnotation, getTypedValue, getURI, hashCode, isSameNodeInfo, iterateAxis, iterateAxis`

Methods inherited from class java.lang.Object
`getClass, notify, notifyAll, toString, wait, wait, wait`

Methods inherited from interface net.sf.saxon.trace.InstructionInfo
`getSystemId`

Field Detail

### ANNOTATION_STRIP

    public static final int ANNOTATION_STRIP

See Also:
  Constant Field Values

### ANNOTATION_PRESERVE

    public static final int ANNOTATION_PRESERVE

See Also:
  Constant Field Values

Constructor Detail

### XSLStylesheet

    public XSLStylesheet()

Method Detail

### setPreparedStylesheet

    public void setPreparedStylesheet(PreparedStylesheet sheet)

  Create link to the owning PreparedStylesheet object

### getPreparedStylesheet

    public PreparedStylesheet getPreparedStylesheet()

  Get the owning PreparedStylesheet object

  Overrides:
    `getPreparedStylesheet` in class `StyleElement`
  Returns:
    the PreparedStylesheet to which this stylesheet element belongs

### getExecutable

    public Executable getExecutable()

  Get the run-time Executable object

  Specified by:
    `getExecutable` in interface `Container`
  Overrides:
    `getExecutable` in class `StyleElement`

### 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

### 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(String name,
                             StringCollator collation)

  Register a named collation (actually a StringCollator)

### getDefaultCollationName

    public String getDefaultCollationName()

  Get the name of the default collation

### 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 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

### prepareAttributes

    public void prepareAttributes()
                           throws XPathException

  Prepare the attributes on the stylesheet element

  Specified by:
    `prepareAttributes` in class `StyleElement`
  Throws:
    `XPathException`

### getDefaultValidation

    public int getDefaultValidation()

  Get the value of the default validation attribute

### getInputTypeAnnotationsAttribute

    public int getInputTypeAnnotationsAttribute()
                                         throws XPathException

  Get the value of the input-type-annotations attribute, for this module alone. The value is an or-ed combination of the two bits `ANNOTATION_STRIP` and `ANNOTATION_PRESERVE`

  Throws:
    `XPathException`

### 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)

### validate

    public void validate()
                  throws XPathException

  Validate this element

  Overrides:
    `validate` in class `StyleElement`
  Throws:
    `XPathException`

### 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`

### spliceIncludes

    public void spliceIncludes()
                        throws XPathException

  Process xsl:include and xsl:import elements.

  Throws:
    `XPathException`

### processAllAttributes

    public void processAllAttributes()
                              throws XPathException

  Process the attributes of every node in the stylesheet

  Overrides:
    `processAllAttributes` in class `StyleElement`
  Throws:
    `XPathException`

### 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 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

### compileStylesheet

    public Executable compileStylesheet()
                                 throws XPathException

  Compile the stylesheet to create an executable.

  Throws:
    `XPathException`

### 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.

### hasChildNodes

    public final boolean hasChildNodes()

  Determine if the node has any children.

  Specified by:
    `hasChildNodes` in interface `NodeInfo`
  Overrides:
    `hasChildNodes` in class `NodeImpl`
  Returns:
    `true` if the node has any children, `false` if the node has no children.

### enumerateChildren

    public final AxisIterator enumerateChildren(NodeTest test)

  Get an enumeration of the children of this node

  Parameters:
    `test` - A NodeTest to be satisfied by the child nodes, or null if all child node are to be returned

### getFirstChild

    public final NodeInfo getFirstChild()

  Get the first child node of the element

  Overrides:
    `getFirstChild` in class `NodeImpl`
  Returns:
    the first child node of the required type, or null if there are no children

### getLastChild

    public final NodeInfo getLastChild()

  Get the last child node of the element

  Overrides:
    `getLastChild` in class `NodeImpl`
  Returns:
    the last child of the element, or null if there are no children

### getStringValue

    public String getStringValue()

  Return the string-value of the node, that is, the concatenation of the character content of all descendent elements and text nodes.

  Returns:
    the accumulated character content of the element, including descendant elements.
  See Also:
    `Item.getStringValueCS()`

### getStringValueCS

    public CharSequence getStringValueCS()

  Description copied from class: `NodeImpl`
  Get the value of the item as a CharSequence. This is in some cases more efficient than the version of the method that returns a String.

  Specified by:
    `getStringValueCS` in interface `Item`
  Specified by:
    `getStringValueCS` in interface `ValueRepresentation`
  Overrides:
    `getStringValueCS` in class `NodeImpl`
  Returns:
    the string value of the item
  See Also:
    `Item.getStringValue()`

### useChildrenArray

    public void useChildrenArray(NodeImpl[] array)

  Supply an array to be used for the array of children. For system use only.

### addChild

    public void addChild(NodeImpl node,
                         int index)

  Add a child node to this node. For system use only. Note: normalizing adjacent text nodes is the responsibility of the caller.

### compact

    public void compact(int size)

  Compact the space used by this node

Copyright (C) Michael H. Kay. All rights reserved.