title: XSLT 3.0 streaming (Saxon)
body: <p>I have a big XML file (6 GB) with this kind of tree:
  </p>
  
  <pre><code>&lt;Report&gt;
     &lt;Document&gt;
        &lt;documentType&gt;E&lt;/documentType&gt;
        &lt;person&gt;
           &lt;firstname&gt;John&lt;/firstname&gt;
           &lt;lastname&gt;Smith&lt;/lastname&gt;
        &lt;/person&gt;
     &lt;/Document&gt;
     &lt;Document&gt;
        [...]
     &lt;/Document&gt;
     &lt;Document&gt;
        [...]
     &lt;/Document&gt;
     [...]
  &lt;/Report&gt;
  </code></pre>
  
  <p>If I apply an XSLT style sheet on it, I have this error:</p>
  
  <blockquote>
    <p>Exception in thread "main" java.lang.OutOfMemoryError: Java heap space</p>
  </blockquote>
  
  <p>So I wanted to try the new XSLT 3.0 feature: streaming, with Saxon 9.6 EE.
  I don't want to have the streaming constrains once in a Document. I think that, what I want to do, is very close to the "burst mode" that is described here: <a href="http://saxonica.com/documentation/html/sourcedocs/streaming/burst-mode-streaming.html" rel="nofollow">http://saxonica.com/documentation/html/sourcedocs/streaming/burst-mode-streaming.html</a></p>
  
  <p>Here is my Saxon command line:</p>
  
  <blockquote>
    <p>java -cp saxon9ee.jar net.sf.saxon.Transform -t -s:input.xml -xsl:stylesheet.xsl -o:output/output.html</p>
  </blockquote>
  
  <p>Here is my XSLT style sheet:
  </p>
  
  <pre><code>&lt;xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="3.0"&gt;
  &lt;xsl:mode streamable="yes" /&gt;
  
  &lt;xsl:template match="/"&gt;
      GLOBAL HEADER
          &lt;xsl:iterate select="copy-of()/Report/Document" &gt;
             DOC HEADER
             documentType: &lt;xsl:value-of select="documentType"/&gt;
             person/firstname: &lt;xsl:value-of select="person/firstname"/&gt;
             DOC FOOTER
             &lt;xsl:next-iteration/&gt;
          &lt;/xsl:iterate&gt;
      GLOBAL FOOTER
  &lt;/xsl:template&gt;
  
  &lt;/xsl:stylesheet&gt;
  </code></pre>
  
  <p>But I still have the same out of memory error.</p>
  
  <p>Thank you for your help!</p>