I am trying this Simon but get the error:

"Failed to execute pipeline.
org.apache.cocoon.ProcessingException: Failed to execute pipeline.:
java.lang.RuntimeException: java.lang.IllegalArgumentException: Width (0)
and height (0) cannot be <= 0"

I placed a width and height on svg:svg and svg:image but still get this
error.

Any clues?

Linc


-----Original Message-----
From: Simon Mieth [mailto:[EMAIL PROTECTED] 
Sent: Friday, 3 September 2004 4:59 AM
To: [EMAIL PROTECTED]
Subject: Re: WordML image to jpeg/gif via cocoon?

On Thu, 02 Sep 2004 15:41:05 +0200
"Gerald Aichholzer" <[EMAIL PROTECTED]> wrote:

> On Thu, 2 Sep 2004 20:59:51 +0800, Lincoln Mitchell 
> <[EMAIL PROTECTED]>  wrote:
> 
> > How would I convert an image in wordML to a jpeg or gif via Cocoon?
> >
> > So far I have only found this .net solution by Oleg Tkachenko:"In 
> > WordML images are embedded into document
> > (Base64 encoded). So when producing HTML, images have to be decoded 
> > and serialized out as external files to link from the generated 
> > HTML. This cannot be done in pure XSLT  1.0.
> > But it's piece of cake using extensions, e.g. take a look at my 
> > sample implementation for .NET:
> > http://www.tkachenko.com/blog/archives/000195.html";
> >
> 
> Hi Lincoln,
> 
> here are some ideas which came just to my minds:
> 
> - convert your WordML to HTML with links for images
>    (similar to the following):
> 
>    <html>
>      ...
>      <img
>      src="http://localhost:8888/getimg.html?imgno=nn"/>...
>    </html>
> 
> - getimg.html is a pipeline which returns the nn'th image
>    from the WordML document (of course you need some
>    method to specify the WordML document, too).
> 
>    Because this is base64 encoded you need to decode it.
>    I don't know if this will be possible using XSLT only,
>    because also in the sample provided by you an external
>    function is used.
> 

Hi,

I know nothing about WordML, but i have worked with OpenOffice FlatXML.
There are the images embedded as base64-data elements too.

The solutions was like Gerald, create a pipeline where you can extract the
image. You will need to pass the document and an image-ID like:

<map:match pattern="test/*/*.jpg">
  <map:generate src="docs/{1}.wordml"/>
  <map:transform src="xsl/wordml2svg.xsl">
     <map:parameter name="image" value="{2}"/>
  </map:transform>
  <map:serialize type="svg2jpeg"/>
</map:match>


You need an XSL-Stylesheet, which extract the image data and create a
SVG-document. The SVG-image-element can hold the data as base64 endcoded
xlink.

Here is a snipped
<xsl:match pattern="[EMAIL PROTECTED] = $image]"> <svg:svg> <svg:g>
  <svg:image xmlns:xlink="http://www.w3.org/1999/xlink";
   width="3cm" height="2cm">     
  <xsl:attribute name="xlink:href">       
    <xsl:text>data:image/png;base64,</xsl:text> 
   <!-- pass the base64 here -->  
     <xsl:value-of
       select="yourBase64"/>          
    </xsl:attribute>
  </svg:image>
</svg:g>
</svg:svg>
</xsl:match>

The SVG-serializer will generate the image. Inside your HTML you can
generate a relative uri too, like <image src="foo/01111.jpg"/> if your page
is foo.html from foo.wordml. 


Best Regards,

Simon


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




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

Reply via email to