You are viewing a plain text version of this content. The canonical link for it is here.
Posted to svn@forrest.apache.org by cd...@apache.org on 2007/01/08 13:44:43 UTC
svn commit: r494046 - in
/forrest/trunk/whiteboard/plugins/org.apache.forrest.plugin.input.odt:
input.xmap resources/stylesheets/odt-to-forrest-xhtml.xsl
Author: cdupoirieux
Date: Mon Jan 8 04:44:42 2007
New Revision: 494046
URL: http://svn.apache.org/viewvc?view=rev&rev=494046
Log:
The style of the sentence can be either in the content.xml or in the style.xml. We have top try both to be sure to find it...
Modified:
forrest/trunk/whiteboard/plugins/org.apache.forrest.plugin.input.odt/input.xmap
forrest/trunk/whiteboard/plugins/org.apache.forrest.plugin.input.odt/resources/stylesheets/odt-to-forrest-xhtml.xsl
Modified: forrest/trunk/whiteboard/plugins/org.apache.forrest.plugin.input.odt/input.xmap
URL: http://svn.apache.org/viewvc/forrest/trunk/whiteboard/plugins/org.apache.forrest.plugin.input.odt/input.xmap?view=diff&rev=494046&r1=494045&r2=494046
==============================================================================
--- 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 Mon Jan 8 04:44:42 2007
@@ -24,6 +24,7 @@
<map:when test="{lm:project.{1}.odt}">
<map:aggregate element="odt">
<map:part src="cocoon:/{1}.meta.odt.xml" element="meta" />
+ <map:part src="cocoon:/{1}.styles.odt.xml" element="styles" />
<map:part src="cocoon:/{1}.content.odt.xml"
element="content" />
</map:aggregate>
@@ -37,6 +38,7 @@
</map:select>
</map:match>
</map:pipeline>
+ <!-- FIXME - We can have just one pipeline to superseed the following... -->
<map:pipeline internal="true">
<map:match pattern="**.meta.odt.xml">
<map:generate src="zip:{lm:project.{1}.odt}!/meta.xml" />
@@ -46,6 +48,12 @@
<map:pipeline internal="true">
<map:match pattern="**.content.odt.xml">
<map:generate src="zip:{lm:project.{1}.odt}!/content.xml" />
+ <map:serialize type="xml" />
+ </map:match>
+ </map:pipeline>
+ <map:pipeline internal="true">
+ <map:match pattern="**.styles.odt.xml">
+ <map:generate src="zip:{lm:project.{1}.odt}!/styles.xml" />
<map:serialize type="xml" />
</map:match>
</map:pipeline>
Modified: forrest/trunk/whiteboard/plugins/org.apache.forrest.plugin.input.odt/resources/stylesheets/odt-to-forrest-xhtml.xsl
URL: http://svn.apache.org/viewvc/forrest/trunk/whiteboard/plugins/org.apache.forrest.plugin.input.odt/resources/stylesheets/odt-to-forrest-xhtml.xsl?view=diff&rev=494046&r1=494045&r2=494046
==============================================================================
--- forrest/trunk/whiteboard/plugins/org.apache.forrest.plugin.input.odt/resources/stylesheets/odt-to-forrest-xhtml.xsl (original)
+++ forrest/trunk/whiteboard/plugins/org.apache.forrest.plugin.input.odt/resources/stylesheets/odt-to-forrest-xhtml.xsl Mon Jan 8 04:44:42 2007
@@ -22,7 +22,8 @@
xmlns:xlink="http://www.w3.org/1999/xlink"
xmlns:style="urn:oasis:names:tc:opendocument:xmlns:style:1.0"
xmlns:draw="urn:oasis:names:tc:opendocument:xmlns:drawing:1.0"
- xmlns:dc="http://purl.org/dc/elements/1.1/">
+ xmlns:dc="http://purl.org/dc/elements/1.1/"
+ xmlns:svg="urn:oasis:names:tc:opendocument:xmlns:svg-compatible:1.0">
<xsl:import href="lm://transform.odt.xhtml"/>
<xsl:param name="path" select="'odt path name'"/>
@@ -127,7 +128,11 @@
tags such as <em>, <strong>, <sup> and <sub>... -->
<xsl:template match="text:span">
<xsl:variable name="styleName" select="@text:style-name"/>
- <xsl:apply-templates select="//office:document-content/office:automatic-styles/style:style[@style:name=$styleName]/style:text-properties/@*[last()]">
+ <!-- the style can be either in content or in style, we try both, one of them does not exist and so is empty... -->
+ <xsl:apply-templates select="//odt/content/office:document-content/office:automatic-styles/style:style[@style:name=$styleName]/style:text-properties/@*[last()]">
+ <xsl:with-param name="text" select="./text()"/>
+ </xsl:apply-templates>
+ <xsl:apply-templates select="//odt/styles/office:document-styles/office:styles/style:style[@style:name=$styleName]/style:text-properties/@*[last()]">
<xsl:with-param name="text" select="./text()"/>
</xsl:apply-templates>
</xsl:template>
@@ -224,10 +229,10 @@
<xsl:variable name="href"><xsl:value-of select="@xlink:href"/></xsl:variable>
<xsl:choose>
<xsl:when test="starts-with($href, 'http:')">
- <img src="{$href}" alt="{@draw:name}"/>
+ <img src="{$href}" alt="{../@draw:name}" heigth="{../@svg:heigth}" width="{../@svg:width}"/>
</xsl:when>
<xsl:otherwise>
- <img src="/{$dirname}openDocumentEmbeddedImages/zip-{$filename}.odt/file-{$href}" alt="{../@draw:name}"/>
+ <img src="/{$dirname}openDocumentEmbeddedImages/zip-{$filename}.odt/file-{$href}" alt="{../@draw:name}" heigth="{../@svg:heigth}" width="{../@svg:width}"/>
</xsl:otherwise>
</xsl:choose>
</xsl:template>
@@ -237,7 +242,20 @@
+-->
<!-- A little more detailled than in the Lenya file, we add a title and a target attribute if it is supplied... -->
<xsl:template match="text:a">
- <a href="{@xlink:href}">
+ <!-- There is a strange behaviour with the links, a .. is used when pointing to a sub-folder instead of '.' -->
+ <!-- we replace it by '.' in the next variable... -->
+ <xsl:variable name="href">
+ <xsl:choose>
+ <xsl:when test="starts-with(@xlink:href,'..')">
+ <xsl:value-of select="substring-after(@xlink:href,'.')"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of select="@xlink:href"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:variable>
+
+ <a href="{$href}">
<xsl:if test="@office:target-frame-name">
<xsl:attribute name="target">
<xsl:value-of select="@office:target-frame-name"/>
@@ -252,4 +270,4 @@
</a>
</xsl:template>
-</xsl:stylesheet>
\ No newline at end of file
+</xsl:stylesheet>