Package net.sf.saxon

Class PreparedStylesheet


public class PreparedStylesheet extends Executable
This PreparedStylesheet class represents a Stylesheet that has been prepared for execution (or "compiled").

Note that the PreparedStylesheet object does not contain a reference to the source stylesheet tree (rooted at an XSLStyleSheet object). This allows the source tree to be garbage-collected when it is no longer required.

The PreparedStylesheet in XSLT 3.0 represents the set of all packages making up an executable stylesheet.

  • Constructor Details

    • PreparedStylesheet

      public PreparedStylesheet(Compilation compilation)
      Constructor - deliberately protected
      Parameters:
      compilation - Compilation options
  • Method Details

    • newController

      public XsltController newController()
      Make a Controller from this stylesheet object.
      Returns:
      the new Controller
      See Also:
    • getCompileTimeParams

      public GlobalParameterSet getCompileTimeParams()
      Get the parameters that were set at compile time. These will generally be static parameters, but it is also permitted to set non-static parameters at compile time.
      Returns:
      the parameters that were set prior to XSLT compilation
    • checkSuppliedParameters

      public void checkSuppliedParameters(GlobalParameterSet params) throws XPathException
      Check that all required parameters have been supplied. Also checks that the supplied parameters dynamically do not conflict with parameters supplied statically. Used in XSLT only.
      Overrides:
      checkSuppliedParameters in class Executable
      Parameters:
      params - the set of parameters that have been supplied dynamically to the transformer (null represents an empty set).
      Throws:
      XPathException - if there is a required parameter for which no value has been supplied
    • getTopLevelPackage

      public StylesheetPackage getTopLevelPackage()
      Overrides:
      getTopLevelPackage in class Executable
    • setRuleManager

      public void setRuleManager(RuleManager rm)
      Set the RuleManager that handles template rules
      Parameters:
      rm - the RuleManager containing details of all the template rules
    • getRuleManager

      public RuleManager getRuleManager()
      Get the RuleManager which handles template rules
      Returns:
      the RuleManager registered with setRuleManager
    • putNamedTemplate

      public void putNamedTemplate(StructuredQName templateName, NamedTemplate template)
      Register the named template with a given name
      Parameters:
      templateName - the name of a named XSLT template
      template - the template
    • getDefaultInitialTemplateName

      public StructuredQName getDefaultInitialTemplateName()
      Get the default initial template name
      Returns:
      the default initial template name
    • setComponentIndex

      public void setComponentIndex(Map<SymbolicName,Component> index)
      Register the index of components
      Parameters:
      index - the component index
    • getComponent

      public Component getComponent(SymbolicName name)
    • isEligibleInitialMode

      public boolean isEligibleInitialMode(Component.M component)
      Ask whether a mode is eligible for invoking from outside the stylesheet
      Parameters:
      component - the component
      Returns:
      true if the component can be referenced from the calling application
    • explainNamedTemplates

      public void explainNamedTemplates(ExpressionPresenter presenter) throws XPathException
      Explain the expression tree for named templates in a stylesheet
      Parameters:
      presenter - destination for the explanatory output
      Throws:
      XPathException - if writing to the output fails
    • getDeclaredSerializationProperties

      public SerializationProperties getDeclaredSerializationProperties()
      Get the properties for xsl:output, including character maps. The object returned will be a clone of the internal values, and thus it can be mutated without affecting the value held in this PreparedStylesheet.

      This method gets the output properties for the unnamed output format in the stylesheet.

      Returns:
      A SerializationProperties object reflecting the output properties defined for the default (unnamed) output format in the stylesheet.
      See Also:
    • getCachedStylesheet

      public PreparedStylesheet getCachedStylesheet(String href, String baseURI)
      Get a "next in chain" stylesheet. This method is intended for internal use.
      Parameters:
      href - the relative URI of the next-in-chain stylesheet
      baseURI - the baseURI against which this relativeURI is to be resolved
      Returns:
      the cached stylesheet if present in the cache, or null if not
    • putCachedStylesheet

      public void putCachedStylesheet(String href, String baseURI, PreparedStylesheet pss)
      Save a "next in chain" stylesheet in compiled form, so that it can be reused repeatedly. This method is intended for internal use.
      Parameters:
      href - the relative URI of the stylesheet
      baseURI - the base URI against which the relative URI is resolved
      pss - the prepared stylesheet object to be cached
    • explain

      public void explain(ExpressionPresenter presenter) throws XPathException
      Produce an XML representation of the compiled and optimized stylesheet, as a human-readable entity
      Parameters:
      presenter - defines the destination and format of the output
      Throws:
      XPathException - if output fails