Class XsltPackage

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

public class XsltPackage extends 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 Details

  • Method Details

    • getProcessor

      public Processor getProcessor()
      Get the Processor under which this package was created
      Returns:
      the corresponding Processor
    • getName

      public String getName()
      Get the name of the package (the URI appearing as the value of xsl:package/@name)
      Returns:
      the package name
    • getVersion

      public 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.
    • getImportedSchema

      public XsdSchema getImportedSchema(String role)
      Get the schema used as the static context of this package in the stylesheet. This will typically include schema components preloaded using XsltCompiler.useSchema(String, XsdSchema), plus schema components loaded using xsl:import-schema declarations within the stylesheet itself.

      This schema can usefully be used for validating source documents that are to be supplied as input to the stylesheet.

      Parameters:
      role - the role-name of the schema: supply null or "" for the default/unnamed role
      Returns:
      the schema used by this package
      Since:
      13.0
    • save

      public void save(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

      @Deprecated public void save(File file, 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 (for example "EE" or "JS")
      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.