XSLT 3.0 streaming (Saxon)



I have a big XML file (6 GB) with this kind of tree:



<Report>
<Document>
<documentType>E</documentType>
<person>
<firstname>John</firstname>
<lastname>Smith</lastname>
</person>
</Document>
<Document>
[...]
</Document>
<Document>
[...]
</Document>
[...]
</Report>


If I apply an XSLT style sheet on it, I have this error:



Exception in thread "main" java.lang.OutOfMemoryError: Java heap space



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 contrains once in a Document. I think that, what I want to do, is very close to the "burst mode" that is described here: http://ift.tt/1vK5wHa


Here is my Saxon command line:



java -cp saxon9ee.jar net.sf.saxon.Transform -t -s:input.xml -xsl:stylesheet.xsl -o:output/output.html



Here is my XSLT style sheet:



<xsl:stylesheet xmlns:xsl="http://ift.tt/tCZ8VR" version="3.0">
<xsl:mode streamable="yes" />

<xsl:template match="/">
GLOBAL HEADER
<xsl:iterate select="copy-of()/Report/Document" >
DOC HEADER
documentType: <xsl:value-of select="documentType"/>
person/firstname: <xsl:value-of select="person/firstname"/>
DOC FOOTER
<xsl:next-iteration/>
</xsl:iterate>
GLOBAL FOOTER
</xsl:template>

</xsl:stylesheet>


But I still have the same out of memory error.


Thank you for your help!


No comments:

Post a Comment