forrest-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Web Maestro Clay <the.webmaes...@gmail.com>
Subject Re: graphics and the odt plugin
Date Tue, 11 Jul 2006 15:26:23 GMT
On Jul 10, 2006, at 6:17 PM, Ross Gardler wrote:
> Paul Bolger wrote:
>> Has anyone had any luck getting the odt plugin to translate graphics
>> from a source document yet?
>
> I've not looked at the ODT plugin and am unlikely to do so in the  
> forseeable future. However, I will mention again that I spent some  
> time making this work in the original OOo plugin. I don't believe  
> the two formats are that different that we cant reuse the same  
> solution.
>
> Ross

I was able to get graphics to display with the ODT plugin. I'll paste  
my `svn diff` below.

NOTE: Unfortunately, it broke the OOo plugin's ability to process  
images (which I still use to convert an OOo Impress file). I believe  
my serializer 'hi-jacked' or 'superceded' the graphics portion of the  
OOo Impress converter.

Hopefully you'll get some ideas here. I got stuck, and then had some  
more pressing 'issues' to deal with (like a newborn...).

[clay@Clays-PB org.apache.forrest.plugin.input.odt]$ svn diff
Index: input.xmap
===================================================================
--- input.xmap  (revision 411040)
+++ input.xmap  (working copy)
@@ -49,6 +49,16 @@
          <map:serialize type="xml" />
        </map:match>
      </map:pipeline>
+
+    <!-- Image Pipeline -->
+    <map:pipeline internal="true">
+      <map:match pattern="openDocumentEmbeddedImage/zip-{1}.odt/file- 
**.*">
+        <map:read src="jar:file:///{lm:project.{1}!/{2}.{3}}" mime- 
type="image/{3}" />
+      </map:match>
+      <map:match pattern="**/openDocumentEmbeddedImage/zip-{1}.odt/ 
file-**.*">
+        <map:read src="jar:file:///{lm:project.{1}/{2}!/{3}.{4}}"  
mime-type="image/{4}" />
+      </map:match>
+    </map:pipeline>
    </map:pipelines>
</map:sitemap>
Index: resources/stylesheets/odt-to-forrest-xhtml.xsl
===================================================================
--- resources/stylesheets/odt-to-forrest-xhtml.xsl      (revision  
411040)
+++ resources/stylesheets/odt-to-forrest-xhtml.xsl      (working copy)
@@ -18,6 +18,7 @@
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/ 
Transform"
    xmlns="http://www.w3.org/1999/xhtml"
    xmlns:office="urn:oasis:names:tc:opendocument:xmlns:office:1.0"
+  xmlns:draw="urn:oasis:names:tc:opendocument:xmlns:drawing:1.0"
    xmlns:text="urn:oasis:names:tc:opendocument:xmlns:text:1.0"
    xmlns:xlink="http://www.w3.org/1999/xlink"
    xmlns:dc="http://purl.org/dc/elements/1.1/" >
@@ -57,4 +58,14 @@
        </body>
      </html>
    </xsl:template>
+
+  <!--+
+      | Images
+      +-->
+  <xsl:template match="draw:image[@xlink:show]">
+    <xsl:variable name="href"><xsl:value-of select="@xlink:href"/></ 
xsl:variable>
+    <img src="openDocumentEmbeddedImage/zip-{$filename}.odt/file- 
{$href}"
+      alt="{@draw:name}" class="{./../@draw:style-name}" />
+  </xsl:template>
+
</xsl:stylesheet>


Web Maestro Clay
the.webmaestro@gmail.com

My religion is simple. My religion is kindness.
-- HH Dalai Lama of Tibet




Mime
View raw message