cocoon-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Simon Mieth <>
Subject Re: Out of Memory error base64 encoded to SVG to JPG
Date Sat, 11 Sep 2004 08:44:42 GMT
On Sat, 11 Sep 2004 10:15:08 +0800
"Lincoln Mitchell" <> wrote:

> I need to convert multiple wordml images (base64 encoded) to JPG.
> I am currently using the following code but get an "Out of Memory" error. If
> I am lucky I get 2 images appear on screen.
> I will try importing low quality JPEG into word to see if that helps and
> also thinking of upgrading RAM or PC current spec is Celeron 2.4GHz, 448MB
> RAM, Running Windows XP (home edition).
> Any clues/recommendations?

Hi Lincoln,

It looks like the cocoon.bat set no parameter for the memory usage, if so the VM only use
maybe this can help

set JAVA_OPTIONS='-Xms32M -Xmx350M'

add this to your cocoon.bat on top? (I dont know  much about BATCH-scripts)


You can try to use the stx-transformer instead of the xslt-transformer.
The xslt-transformation build a DOM-Document,which consume many memory and you only need to
extract a fragment of this document. 
The stx-transformation is SAX-based and can extract the fragment too without building a DOM-Document.

Based on your document-structure of wordml, the w:binData-element has the attribute w:name
which looks like it is a unique  id. If so you could try to work with this id to extract the
binData. This could be done with the following stx-stylesheet.

<?xml version="1.0"?>
<stx:transform xmlns:stx="" xmlns=""
xmlns:w="" version="1.0">

  <stx:param name="image" select="''"/>

  <stx:template match="w:binData[@w:name = $image]">
    <svg:svg xmlns:svg="" width="40" height="30">
        <svg:image xmlns:xlink="" width="40" height="30">
          <stx:attribute name="xlink:href">
            <stx:value-of select="."/>

and a pipeline like this
<map:match pattern="*.jpg">
	<map:generate src="content/content.xml"/>
	<map:transform src="stylesheets/wordml2svg.stx" type="stx">
		<map:parameter name="image" value="wordml://{1}.jpg"/>
	<map:serialize type="svg2jpeg"/>

inside your html-xsl you have to extract the w:binData/@w:name
and with the string-functions of xsl you can get substring (remove the 'wordml://' and '.jpg')
for your imageid.

The different of stx and xsl is in this case small, but stx is limited
look at 

Best Regards,


To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message