title: How can I use a packaged (exported) stylesheet with saxon 9.7+ s9api?
body: <p>Starting with Saxon 9.7 we have to use a different s9api procedure to "import" a packaged stylesheet. <a href="https://stackoverflow.com/a/37149959/1707353">Here</a>, Michael says "Stylesheet packages can ... be imported ... using ... the s9api API." He then referred to <a href="http://www.saxonica.com/documentation/index.html#!using-xsl/compiling" rel="nofollow noreferrer">these</a> details.</p>
  
  <p>As I read it, hoping that it would be simple, I locked in on this:</p>
  
  <blockquote>
    <p>A stylesheet export file ... is accepted by any Saxon interface that accepts a source stylesheet.</p>
  </blockquote>
  
  <p>So, I created this MCV example:</p>
  
  <pre><code>import java.io.*;
  import net.sf.saxon.Configuration;
  import net.sf.saxon.s9api.Processor;
  import net.sf.saxon.s9api.XsltCompiler;
  import net.sf.saxon.s9api.XsltExecutable;
  import javax.xml.transform.Source;
  import javax.xml.transform.stream.StreamSource;
  public class test {
      public static void main (String args[]) throws Exception {
          Processor saxProc = new Processor(false);
          Configuration saxCfg = saxProc.getUnderlyingConfiguration();
          XsltCompiler saxComp = saxProc.newXsltCompiler();
          File xslmain = new File(args[0]);
          Source xsl = new StreamSource(xslmain);
          XsltExecutable saxExe = saxComp.compile(xsl);
      }
  }
  </code></pre>
  
  <p>Executed like this (using 9.9.1.7J for ee, pe, and he) no exception is thrown:</p>
  
  <pre><code>$ javac -classpath saxon9pe.jar test.java
  $ java -classpath .:saxon9he.jar test something.xsl
  </code></pre>
  
  <p>But if I package up something.xsl (i.e., use EE to export it to an xml file) and execute the MCV like this, then an exception is thrown:</p>
  
  <pre><code>$ java -classpath .:saxon9he.jar test something-exported.xml
  Error
    SXPK0002: Cannot load expression with tag indexedFilter2. The stylesheet uses Saxon-EE features
  Exception in thread "main" net.sf.saxon.s9api.SaxonApiException: Cannot load expression with tag indexedFilter2. The stylesheet uses Saxon-EE features
  </code></pre>
  
  <p>Shouldn't I be able to package an xsl file using EE, distribute HE, and read the packaged stylesheet using HE to perform transformations? If yes, how?</p>