Package net.sf.saxon.s9api

## Class XsltPackage

- java.lang.Object
- - net.sf.saxon.s9api.XsltPackage

-     public class XsltPackage
      extends java.lang.Object

  An XsltPackage object represents the result of compiling an XSLT 3.0 package, as represented by an XML document containing an `xsl:package` element.
  Since:
    9.6

- - ### Constructor Summary

    Constructors
    Modifier | Constructor | Description
    --- | --- | ---
    `protected` | `XsltPackage​(XsltCompiler compiler, StylesheetPackage pp)` |

  - ### Method Summary

    All Methods Instance Methods Concrete Methods Deprecated Methods
    Modifier and Type | Method | Description
    --- | --- | ---
    `java.lang.String` | `getName()` | Get the name of the package (the URI appearing as the value of `xsl:package/@name`)
    `PackageVersion` | `getPackageVersion()` | Get the version of the package as a structured object that meets the requirements of http://www.w3.org/TR/xslt-30/#package-versions
    `Processor` | `getProcessor()` | Get the processor under which this package was created
    `StylesheetPackage` | `getUnderlyingPreparedPackage()` | Escape-hatch interface to the underlying implementation class.
    `java.lang.String` | `getVersion()` | Get the version number of the package (the value of the attribute `xsl:package/@package-version`.
    `WhitespaceStrippingPolicy` | `getWhitespaceStrippingPolicy()` | Get the whitespace stripping policy defined by this stylesheet package, that is, the policy defined by the xsl:strip-space and xsl:preserve-space elements in the source XSLT code of the package.
    `XsltExecutable` | `link()` | Link this package with the packages it uses, to form an executable stylesheet.
    `void` | `save​(java.io.File file)` | Save this compiled package to filestore.
    `void` | `save​(java.io.File file, java.lang.String target)` | Deprecated. since 9.9.1.3.

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Constructor Detail

    - #### XsltPackage

          protected XsltPackage​(XsltCompiler compiler,
                                StylesheetPackage pp)

  - ### Method Detail

    - #### getProcessor

          public Processor getProcessor()

      Get the processor under which this package was created
      Returns:
        the corresponding Processor

    - #### getName

          public java.lang.String getName()

      Get the name of the package (the URI appearing as the value of `xsl:package/@name`)
      Returns:
        the package name

    - #### getVersion

          public java.lang.String getVersion()

      Get the version number of the package (the value of the attribute `xsl:package/@package-version`. Note that this may have had trailing zeroes truncated.
      Returns:
        the package version number(s)+suffix?

    - #### getPackageVersion

          public PackageVersion getPackageVersion()

      Get the version of the package as a structured object that meets the requirements of http://www.w3.org/TR/xslt-30/#package-versions
      Returns:
        the package version of the stylesheet

    - #### getWhitespaceStrippingPolicy

          public WhitespaceStrippingPolicy getWhitespaceStrippingPolicy()

      Get the whitespace stripping policy defined by this stylesheet package, that is, the policy defined by the xsl:strip-space and xsl:preserve-space elements in the source XSLT code of the package.
      Returns:
        a newly constructed WhitespaceStrippingPolicy based on the declarations in this stylesheet package. This policy can be used as input to a `DocumentBuilder`.

    - #### link

          public XsltExecutable link()
                              throws SaxonApiException

      Link this package with the packages it uses, to form an executable stylesheet. This process fixes up any cross-package references to files, templates, and other components, and checks to ensure that all such references are consistent.
      Returns:
        the resulting XsltExecutable
      Throws:
        `SaxonApiException` - if any error is found during the linking process, for example if the constituent packages containing duplicate component names, or if abstract components are not resolved.

    - #### save

          public void save​(java.io.File file)
                    throws SaxonApiException

      Save this compiled package to filestore.
      Parameters:
        `file` - the file to which the compiled package should be saved
      Throws:
        `SaxonApiException` - if the compiled package cannot be saved to the specified location, or if the package was compiled with just-in-time compilation enabled
      Since:
        9.7

    - #### save

          public void save​(java.io.File file,
                           java.lang.String target)
                    throws SaxonApiException

      Deprecated.
      since 9.9.1.3. Use XsltCompiler.setTargetEdition() to define the target environment.
      Save this compiled package to filestore for a particular target environment
      Parameters:
        `file` - the file to which the compiled package should be saved
        `target` - the target environment. The only value currently recognized is "JS", which exports the package for running under Saxon-JS 2.0.
      Throws:
        `SaxonApiException` - if the compiled package cannot be saved to the specified location, or if the package was compiled with just-in-time compilation enabled.
      Since:
        9.7.0.5

    - #### getUnderlyingPreparedPackage

          public StylesheetPackage getUnderlyingPreparedPackage()

      Escape-hatch interface to the underlying implementation class.
      Returns:
        the underlying StylesheetPackage. The interface to StylesheetPackage is not a stable part of the s9api API definition.