[xsl] How to transform a huge XML-file (memory-saving)?

Subject: [xsl] How to transform a huge XML-file (memory-saving)?
From: news@xxxxxxxxxxx
Date: Tue, 9 Aug 2005 15:49:11 +0200
Hello List,

i'm looking for a solution to handle the xslt-transformation of huge data
files.
If i try to process a 176 mb XML-file with saxon8, the java enviroment uses
a lot of main-memory - round about 1 gb.
This XML-file contains a always repeating block of a structure like this:

    <OBJECT R='XMLEXPBE'>
      <AUFNR>0000463105</AUFNR>
      <AUFDAT>28.11.2000</AUFDAT>
      <FALNR>0200036273</FALNR>
      <MAT>EBLUT</MAT>
      <ANFO>BG</ANFO>
      <UNT>AB0</UNT>
      <ERG>A</ERG>
      <USER>JO</USER>
    </OBJECT>

To process this XML-structure, i used a normal template structure like this:

<xsl:template match="/">  
  <!--<xsl:call-template name="XmlInfo"/>-->  
  <xsl:apply-templates select="//OBJECT" mode="Bestimmungen"/>  
</xsl:template>

<xsl:template match="OBJECT" mode="Bestimmungen">
 
<xsl:text>MSH|^~\&amp;|||||||ZBM|</xsl:text><xsl:text>&#13;&#10;</xsl:text>
 ...........
</xsl:template>


I expect to get a much larger data-file soon. So i think, i will get a
problem with the main memory capacity.
To split the file isn't a possibility, because i have to link between the
data-blocks.

Has anybody an idea, whether an more effective (less memory) way of
programming exists?

I tried to use <xsl:key ...> and the key()-function to built an index. But
it doesn't fit in the <xsl:template ...> - enviroment.
Is it possible to bring both concepts together?

Thanks a lot!
Andrej.

Current Thread