On 11.09.2004 04:15, Lincoln Mitchell wrote:

I need to convert multiple wordml images (base64 encoded) to JPG.

How big is the WordML file? There is also the option that it is not the rendering of the images, but the transformations.


Sitemap.xmap
------------
<map:match pattern="*.jpg">
        <map:generate src="content/content.xml"/>
        <map:transform src="stylesheets/wordml2svg.xsl">
                <map:parameter name="image" value="{1}"/>
        </map:transform>

It seems to be heavy to do this transformation multiple times though you need to do it only once using the FragmentExtractorTransformer. Could help to reduce the memory needs.


        <map:serialize type="svg2jpeg"/>
</map:match>


wordml2svg.xsl -------------- <?xml version="1.0" encoding="UTF-8"?> <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"; xmlns:w="http://schemas.microsoft.com/office/word/2003/wordml"; xmlns:wx="http://schemas.microsoft.com/office/word/2003/auxHint"; xmlns:v="urn:schemas-microsoft-com:vml" xmlns:o="urn:schemas-microsoft-com:office:office"> <xsl:param name="image"/> <xsl:template match="/"> <xsl:apply-templates select="//w:pict"/>

//w:pict is very bad as it makes it necessary to build up the complete XML file. And as it is for OpenOffice's content.xml I guess the WordML file can also be very big - especially when there are images encoded.


Just remove this template and add one working through the tree:

<xsl:template match="*">
  <xsl:apply-templates select="*"/>
</xsl:template>

        </xsl:template>
        <xsl:template match="//w:pict">

Here you can remove the double slashes, they have no effect.

                <xsl:if test="v:shape/v:[EMAIL PROTECTED]:title=$image]">
                        <xsl:apply-templates select="w:binData"/>
                </xsl:if> 
        </xsl:template>
        <xsl:template match="w:binData">
                        <svg:svg xmlns:svg="http://www.w3.org/SVG";
width="40" height="30">
                                <svg:g>
                                        <svg:image
xmlns:xlink="http://www.w3.org/1999/xlink"; width="40" height="30">
                                                        <xsl:attribute
name="xlink:href"><xsl:text>data:image/png;base64,</xsl:text><xsl:value-of
select="."/></xsl:attribute>
                                        </svg:image>
                                </svg:g>
                        </svg:svg>
        </xsl:template>
</xsl:stylesheet>

Rest of the stylesheet is ok AFAICS.

Joerg

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Reply via email to