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

Subject: RE: [xsl] How to transform a huge XML-file (memory-saving)?
From: "Michael Kay" <mike@xxxxxxxxxxxx>
Date: Thu, 11 Aug 2005 23:14:38 +0100
You could try the new facility in Saxon-SA 8.5 to process the file
sequentially. Whether this is possible depends on precisely how you want to
transform each OBJECT element. It's not entirely clear what you mean when
you say that you "have to link between the data-blocks".

Michael Kay
http://www.saxonica.com/ 

> -----Original Message-----
> From: news@xxxxxxxxxxx [mailto:news@xxxxxxxxxxx] 
> Sent: 09 August 2005 14:49
> To: 'xsl-list@xxxxxxxxxxxxxxxxxxxxxx'
> Subject: [xsl] How to transform a huge XML-file (memory-saving)?
> 
> 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;&#1
0;</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