You are viewing a plain text version of this content. The canonical link for it is here.
Posted to svn@forrest.apache.org by th...@apache.org on 2006/04/28 00:08:16 UTC
svn commit: r397657 - in
/forrest/trunk/whiteboard/plugins/org.apache.forrest.plugin.input.odt:
input.xmap locationmap.xml resources/stylesheets/odt-to-forrest-xhtml.xsl
Author: thorsten
Date: Thu Apr 27 15:08:14 2006
New Revision: 397657
URL: http://svn.apache.org/viewcvs?rev=397657&view=rev
Log:
Bugfix FOR-872 - Using parts of the attachment odt_plugin.diff from Clay Leeds. Thanks Clay. I extended the odt plugin to read as well the odt meta data. Further I added a forrest specific xsl for odt based on the lenya one. There is a problem with the that needs some attention.
Added:
forrest/trunk/whiteboard/plugins/org.apache.forrest.plugin.input.odt/resources/stylesheets/odt-to-forrest-xhtml.xsl
- copied, changed from r397628, lenya/trunk/src/modules/opendocument/xslt/opendocument2xhtml.xsl
Modified:
forrest/trunk/whiteboard/plugins/org.apache.forrest.plugin.input.odt/input.xmap
forrest/trunk/whiteboard/plugins/org.apache.forrest.plugin.input.odt/locationmap.xml
Modified: forrest/trunk/whiteboard/plugins/org.apache.forrest.plugin.input.odt/input.xmap
URL: http://svn.apache.org/viewcvs/forrest/trunk/whiteboard/plugins/org.apache.forrest.plugin.input.odt/input.xmap?rev=397657&r1=397656&r2=397657&view=diff
==============================================================================
--- forrest/trunk/whiteboard/plugins/org.apache.forrest.plugin.input.odt/input.xmap (original)
+++ forrest/trunk/whiteboard/plugins/org.apache.forrest.plugin.input.odt/input.xmap Thu Apr 27 15:08:14 2006
@@ -20,8 +20,15 @@
<map:resource name="file-resolver">
<map:select type="exists">
<map:when test="{lm:project.{uri}.odt}">
- <map:generate src="zip://content.xml@{lm:project.{uri}.odt}" />
- <map:transform src="{lm:transform.odt.xhtml}" />
+ <map:aggregate element="odt">
+ <map:part src="cocoon:/{uri}.meta.odt.xml" element="meta" />
+ <map:part src="cocoon:/{uri}.content.odt.xml"
+ element="content" />
+ </map:aggregate>
+ <map:transform src="{lm:transform.odt-forrest.xhtml}">
+ <!-- FIXME the {url} is always null. Could be that extracting the match out of the resources fixes this -->
+ <!-- <map:parameter name="filename" value="test-{url}" /> -->
+ </map:transform>
<map:transform src="{lm:transform.xml.xml-namespace-stripped}" />
<map:transform src="{lm:transform.html.document}" />
<map:serialize type="xml" />
@@ -38,7 +45,18 @@
</map:call>
</map:match>
</map:pipeline>
- <map:pipeline />
+ <map:pipeline internal="true">
+ <map:match pattern="**.meta.odt.xml">
+ <map:generate src="zip://meta.xml@{lm:project.{1}.odt}" />
+ <map:serialize type="xml" />
+ </map:match>
+ </map:pipeline>
+ <map:pipeline internal="true">
+ <map:match pattern="**.content.odt.xml">
+ <map:generate src="zip://content.xml@{lm:project.{1}.odt}" />
+ <map:serialize type="xml" />
+ </map:match>
+ </map:pipeline>
</map:pipelines>
</map:sitemap>
Modified: forrest/trunk/whiteboard/plugins/org.apache.forrest.plugin.input.odt/locationmap.xml
URL: http://svn.apache.org/viewcvs/forrest/trunk/whiteboard/plugins/org.apache.forrest.plugin.input.odt/locationmap.xml?rev=397657&r1=397656&r2=397657&view=diff
==============================================================================
--- forrest/trunk/whiteboard/plugins/org.apache.forrest.plugin.input.odt/locationmap.xml (original)
+++ forrest/trunk/whiteboard/plugins/org.apache.forrest.plugin.input.odt/locationmap.xml Thu Apr 27 15:08:14 2006
@@ -37,5 +37,12 @@
/>
</select>
</match>
+ <match pattern="transform.odt-forrest.xhtml">
+ <select>
+ <location
+ src="{forrest:plugins}/org.apache.forrest.plugin.input.odt/resources/stylesheets/odt-to-forrest-xhtml.xsl"
+ />
+ </select>
+ </match>
</locator>
</locationmap>
Copied: forrest/trunk/whiteboard/plugins/org.apache.forrest.plugin.input.odt/resources/stylesheets/odt-to-forrest-xhtml.xsl (from r397628, lenya/trunk/src/modules/opendocument/xslt/opendocument2xhtml.xsl)
URL: http://svn.apache.org/viewcvs/forrest/trunk/whiteboard/plugins/org.apache.forrest.plugin.input.odt/resources/stylesheets/odt-to-forrest-xhtml.xsl?p2=forrest/trunk/whiteboard/plugins/org.apache.forrest.plugin.input.odt/resources/stylesheets/odt-to-forrest-xhtml.xsl&p1=lenya/trunk/src/modules/opendocument/xslt/opendocument2xhtml.xsl&r1=397628&r2=397657&rev=397657&view=diff
==============================================================================
--- lenya/trunk/src/modules/opendocument/xslt/opendocument2xhtml.xsl (original)
+++ forrest/trunk/whiteboard/plugins/org.apache.forrest.plugin.input.odt/resources/stylesheets/odt-to-forrest-xhtml.xsl Thu Apr 27 15:08:14 2006
@@ -6,22 +6,41 @@
xmlns:office="urn:oasis:names:tc:opendocument:xmlns:office: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/"
>
-<xsl:import href="fallback://lenya/modules/opendocument/xslt/common/odt_to_xhtml.xsl"/>
-<!-- default parameter value -->
-<xsl:param name="rendertype" select="''"/>
-
-<xsl:param name="language" select="'none'"/>
+<xsl:import href="lm://transform.odt.xhtml"/>
+<xsl:param name="filename" select="'odt file name'"/>
+<xsl:template match="/">
+ <xsl:apply-templates select="/odt/content/*"/>
+</xsl:template>
<xsl:template match="office:document-content">
- <div id="body">
-<!--
-Language: <xsl:value-of select="$language"/>
--->
- <h1>OpenDocument Content (content.xml)</h1>
- <xsl:apply-templates select="office:body/office:text"/>
- </div>
+<html xmlns="http://www.w3.org/1999/xhtml">
+<head>
+ <title>
+ <xsl:choose>
+ <!-- display title element from ODT File:Properties -->
+ <xsl:when test="//odt/meta/office:document-meta/office:meta/dc:title">
+ <xsl:value-of select="//odt/meta/office:document-meta/office:meta/dc:title"/>
+ </xsl:when>
+ <!-- if no title element, display 1st h1 -->
+ <xsl:when test="not(//odt/meta/office:document-meta/office:meta/dc:title) and
+ office:body/office:text/text:h[1] != ''">
+ <xsl:value-of select="office:body/office:text/text:h[1]"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <!-- if no title element or h1 elements, display $filename -->
+ <xsl:value-of select="$filename"/>
+ </xsl:otherwise>
+ </xsl:choose>
+</title>
+<meta http-equiv="Content-Type" content="text/html;charset=utf-8" />
+<xsl:apply-templates select="office:automatic-styles"/>
+</head>
+<body>
+<xsl:apply-templates select="office:body/office:text"/>
+</body>
+</html>
</xsl:template>
-
</xsl:stylesheet>