[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

Running out of Memory

Subject: Running out of Memory
From: Terry Badger <terry_badger@xxxxxxxxx>
Date: Wed, 15 Aug 2012 13:02:43 -0700 (PDT)
 Running out of Memory
I use the attached template to collect all of the files in a given archieve
into a variable $all-chapters and each time the loop ran it would destory the
variable and I would use little memory. After processing a few 100 archieves I
run out of memory. Am I thinging about this correctly? Is there a more correct
way to do this?
Terry
Here is the template:
<xsl:templatename="main">
<xsl:result-documenthref="{concat($protocol , $base-out , '/' , $date ,
'_all-chapters_' , $book , '.txt')}"format="badger-1">
<!--
==================================================================== -->
<!--
use Java to get the list of files - not all version of Saxon will work -->
<xsl:variablename="dir"select="file:new(resolve-uri(concat('file:/' ,
$base-in)))"/>
<xsl:variablename="files"select="file:listFiles($dir)"/>
<xsl:for-eachselect="$files">
<xsl:variablename="uri-to-string">
<xsl:value-ofselect="."/>
</xsl:variable>
<xsl:variablename="file-name"select="subsequence(reverse(tokenize($uri-to-str
ing, '\\')), 1, 1)"/>
<!-- process the selected book or All -->
<xsl:variablename="all-chapters">
<xsl:variablename="chapter"select="$file-name"/>
<xsl:variablename="document"select="doc(concat($jar-protocol , $base-in ,
$file-name , '!' , '/designmap.xml'))"/>
<xsl:elementname="chapter">
<xsl:attributename="name"select="$chapter"/>
<xsl:copy-ofselect="$document"/>
<xsl:elementname="MasterSpreads-all">
<xsl:for-eachselect="$document/Document/idPkg:MasterSpread/@src">
<xsl:copy-ofselect="doc(concat($jar-protocol , $base-in , $file-name , '!/' ,
.))"/>
</xsl:for-each>
</xsl:element>
<xsl:elementname="Spreads-all">
<xsl:for-eachselect="$document/Document/idPkg:Spread/@src">
<xsl:copy-ofselect="doc(concat($jar-protocol , $base-in , $file-name , '!/' ,
.))"/>
</xsl:for-each>
</xsl:element>
<xsl:elementname="Stories-all">
<xsl:for-eachselect="$document/Document/idPkg:Story/@src">
<xsl:copy-ofselect="doc(concat($jar-protocol , $base-in , $file-name , '!/' ,
.))"/>
</xsl:for-each>
</xsl:element>
</xsl:element>
</xsl:variable>
<!-- the
work is done here -->
<!-- <xsl:apply-templates select="$all-chapters"/>-->
</xsl:for-each>
</xsl:result-document>
</xsl:template>

Current Thread

PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.