[Zope3-checkins] CVS: zopeproducts/xslt_examples - example.xml:1.2 ooo2html.xsl:1.2
Philipp von Weitershausen
philikon@philikon.de
Mon, 28 Apr 2003 12:35:07 -0400
Update of /cvs-repository/zopeproducts/xslt_examples
In directory cvs.zope.org:/tmp/cvs-serv21031
Modified Files:
example.xml ooo2html.xsl
Log Message:
Fixed line wrapping.
=== zopeproducts/xslt_examples/example.xml 1.1 => 1.2 ===
--- zopeproducts/xslt_examples/example.xml:1.1 Sun Apr 13 12:31:49 2003
+++ zopeproducts/xslt_examples/example.xml Mon Apr 28 12:35:07 2003
@@ -1,2 +1,70 @@
<?xml version="1.0" encoding="UTF-8"?>
-<!DOCTYPE office:document-content PUBLIC "-//OpenOffice.org//DTD OfficeDocument 1.0//EN" "office.dtd"><office:document-content xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://openoffice.org/hypothetical/document.xsd" xmlns:office="http://openoffice.org/2000/office" xmlns:style="http://openoffice.org/2000/style" xmlns:text="http://openoffice.org/2000/text" xmlns:table="http://openoffice.org/2000/table" xmlns:draw="http://openoffice.org/2000/drawing" xmlns:fo="http://www.w3.org/1999/XSL/Format" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:number="http://openoffice.org/2000/datastyle" xmlns:svg="http://www.w3.org/2000/svg" xmlns:chart="http://openoffice.org/2000/chart" xmlns:dr3d="http://openoffice.org/2000/dr3d" xmlns:math="http://www.w3.org/1998/Math/MathML" xmlns:form="http://openoffice.org/2000/form" xmlns:script="http://openoffice.org/2000/script" office:class="text" office:version="1.0"><office:script/><office:font-decls><style:font-d!
ecl style:name="Arial Unicode MS" fo:font-family="'Arial Unicode MS'" style:font-pitch="variable"/><style:font-decl style:name="HG Mincho Light J" fo:font-family="'HG Mincho Light J'" style:font-pitch="variable"/><style:font-decl style:name="Thorndale" fo:font-family="Thorndale" style:font-family-generic="roman" style:font-pitch="variable"/><style:font-decl style:name="Albany" fo:font-family="Albany" style:font-family-generic="swiss" style:font-pitch="variable"/></office:font-decls><office:automatic-styles/><office:body><text:sequence-decls><text:sequence-decl text:display-outline-level="0" text:name="Illustration"/><text:sequence-decl text:display-outline-level="0" text:name="Table"/><text:sequence-decl text:display-outline-level="0" text:name="Text"/><text:sequence-decl text:display-outline-level="0" text:name="Drawing"/></text:sequence-decls><text:h text:style-name="Heading 1" text:level="1">Hello world</text:h><text:p text:style-name="Standard"/><text!
:p text:style-name="Standard">This OpenOffice document is automatically transformed to HTML by Zope 3's fledgling XML architecture.</text:p></office:body></office:document-content>
\ No newline at end of file
+<!DOCTYPE office:document-content PUBLIC "-//OpenOffice.org//DTD OfficeDocument 1.0//EN" "office.dtd">
+<office:document-content
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xmlns:office="http://openoffice.org/2000/office"
+ xmlns:style="http://openoffice.org/2000/style"
+ xmlns:text="http://openoffice.org/2000/text"
+ xmlns:table="http://openoffice.org/2000/table"
+ xmlns:draw="http://openoffice.org/2000/drawing"
+ xmlns:fo="http://www.w3.org/1999/XSL/Format"
+ xmlns:xlink="http://www.w3.org/1999/xlink"
+ xmlns:number="http://openoffice.org/2000/datastyle"
+ xmlns:svg="http://www.w3.org/2000/svg"
+ xmlns:chart="http://openoffice.org/2000/chart"
+ xmlns:dr3d="http://openoffice.org/2000/dr3d"
+ xmlns:math="http://www.w3.org/1998/Math/MathML"
+ xmlns:form="http://openoffice.org/2000/form"
+ xmlns:script="http://openoffice.org/2000/script"
+ office:class="text"
+ office:version="1.0"
+ xsi:schemaLocation="http://openoffice.org/hypothetical/document.xsd">
+
+ <office:script/>
+
+ <office:font-decls>
+ <style:font-decl
+ style:name="Arial Unicode MS"
+ fo:font-family="'Arial Unicode MS'"
+ style:font-pitch="variable"/>
+ <style:font-decl
+ style:name="HG Mincho Light J"
+ fo:font-family="'HG Mincho Light J'"
+ style:font-pitch="variable"/>
+ <style:font-decl
+ style:name="Thorndale"
+ fo:font-family="Thorndale"
+ style:font-family-generic="roman"
+ style:font-pitch="variable"/>
+ <style:font-decl
+ style:name="Albany"
+ fo:font-family="Albany"
+ style:font-family-generic="swiss"
+ style:font-pitch="variable"/>
+ </office:font-decls>
+
+ <office:automatic-styles/>
+
+ <office:body>
+ <text:sequence-decls>
+ <text:sequence-decl text:display-outline-level="0"
+ text:name="Illustration"/>
+ <text:sequence-decl text:display-outline-level="0"
+ text:name="Table"/>
+ <text:sequence-decl text:display-outline-level="0"
+ text:name="Text"/>
+ <text:sequence-decl text:display-outline-level="0"
+ text:name="Drawing"/>
+ </text:sequence-decls>
+
+ <text:h text:style-name="Heading 1" text:level="1">Hello world</text:h>
+
+ <text:p text:style-name="Standard"/>
+
+ <text:p text:style-name="Standard">
+ This OpenOffice document is automatically transformed to HTML by
+ Zope 3's fledgling XML architecture.
+ </text:p>
+
+ </office:body>
+</office:document-content>
\ No newline at end of file
=== zopeproducts/xslt_examples/ooo2html.xsl 1.1 => 1.2 ===
--- zopeproducts/xslt_examples/ooo2html.xsl:1.1 Sun Apr 13 12:31:49 2003
+++ zopeproducts/xslt_examples/ooo2html.xsl Mon Apr 28 12:35:07 2003
@@ -56,8 +56,10 @@
<!-- Paragraph -->
<xsl:template match="//text:p">
<p>
- <xsl:if test="@text:style-name"> <!-- if this attribute is there, it refers to a style definition -->
- <xsl:call-template name="apply-style" /> <!-- thus, add CSS styles -->
+ <!-- if this attribute is there, it refers to a style definition -->
+ <xsl:if test="@text:style-name">
+ <!-- thus, add CSS styles -->
+ <xsl:call-template name="apply-style" />
</xsl:if>
<xsl:apply-templates />
</p>
@@ -66,7 +68,8 @@
<!-- Space -->
<xsl:template match="//text:s">
- <xsl:for-each select="@text:c"> <!-- XXX range() function or something... -->
+ <!-- XXX a range() function or something like that would be useful... -->
+ <xsl:for-each select="@text:c">
<xsl:text> </xsl:text>
</xsl:for-each>
</xsl:template>
@@ -81,8 +84,10 @@
<!-- Span -->
<xsl:template match="//text:span">
<span>
- <xsl:if test="@text:style-name"> <!-- if this attribute is there, it refers to a style definition -->
- <xsl:call-template name="apply-style" /> <!-- thus, add CSS styles -->
+ <!-- if this attribute is there, it refers to a style definition -->
+ <xsl:if test="@text:style-name">
+ <!-- thus, add CSS styles -->
+ <xsl:call-template name="apply-style" />
</xsl:if>
<xsl:apply-templates />
</span>
@@ -92,9 +97,13 @@
<!-- Link -->
<xsl:template match="//text:a">
<a>
- <xsl:attribute name="href"><xsl:value-of select="@xlink:href" /></xsl:attribute>
+ <xsl:attribute name="href">
+ <xsl:value-of select="@xlink:href" />
+ </xsl:attribute>
<xsl:if test="@office:target-frame-name">
- <xsl:attribute name="target"><xsl:value-of select="@office:target-frame-name" /></xsl:attribute>
+ <xsl:attribute name="target">
+ <xsl:value-of select="@office:target-frame-name" />
+ </xsl:attribute>
</xsl:if>
<xsl:apply-templates />
</a>
@@ -140,8 +149,10 @@
<!-- Table -->
<xsl:template match="//table:table">
<table>
- <xsl:if test="@table:style-name"> <!-- if this attribute is there, it refers to a style definition -->
- <xsl:call-template name="apply-style"> <!-- thus, add CSS styles -->
+ <!-- if this attribute is there, it refers to a style definition -->
+ <xsl:if test="@table:style-name">
+ <!-- thus, add CSS styles -->
+ <xsl:call-template name="apply-style">
<xsl:with-param name="style-name" select="@table:style-name" />
</xsl:call-template>
</xsl:if>
@@ -159,8 +170,10 @@
<!-- Table Row -->
<xsl:template match="//table:table-row">
<tr>
- <xsl:if test="@table:style-name"> <!-- if this attribute is there, it refers to a style definition -->
- <xsl:call-template name="apply-style"> <!-- thus, add CSS styles -->
+ <!-- if this attribute is there, it refers to a style definition -->
+ <xsl:if test="@table:style-name">
+ <!-- thus, add CSS styles -->
+ <xsl:call-template name="apply-style">
<xsl:with-param name="style-name" select="@table:style-name" />
</xsl:call-template>
</xsl:if>
@@ -172,8 +185,10 @@
<!-- Table Cell -->
<xsl:template match="//table:table-cell">
<td>
- <xsl:if test="@table:style-name"> <!-- if this attribute is there, it refers to a style definition -->
- <xsl:call-template name="apply-style"> <!-- thus, add CSS styles -->
+ <!-- if this attribute is there, it refers to a style definition -->
+ <xsl:if test="@table:style-name">
+ <!-- thus, add CSS styles -->
+ <xsl:call-template name="apply-style">
<xsl:with-param name="style-name" select="@table:style-name" />
</xsl:call-template>
</xsl:if>
@@ -183,8 +198,10 @@
<xsl:template match="//table:table-cell" mode="header-row">
<th>
- <xsl:if test="@table:style-name"> <!-- if this attribute is there, it refers to a style definition -->
- <xsl:call-template name="apply-style"> <!-- thus, add CSS styles -->
+ <!-- if this attribute is there, it refers to a style definition -->
+ <xsl:if test="@table:style-name">
+ <!-- thus, add CSS styles -->
+ <xsl:call-template name="apply-style">
<xsl:with-param name="style-name" select="@table:style-name" />
</xsl:call-template>
</xsl:if>
@@ -209,15 +226,18 @@
insert a style attribute with CSS styles -->
<xsl:param name="style-name" select="@text:style-name" />
<xsl:attribute name="style">
- <xsl:apply-templates select="//style:style[@style:name=$style-name]/style:properties/@*" mode="style" />
+ <xsl:apply-templates
+ select="//style:style[@style:name=$style-name]/style:properties/@*"
+ mode="style" />
</xsl:attribute>
</xsl:template>
<!-- Format Attributes -->
<xsl:template match="@fo:*|@style:width" mode="style">
- <!-- The following attributes in the XSL format (fo) namespace are used by OpenOffice.org
- but don't seem to be part of CSS. This may lead to not 100% valid CSS.
+ <!-- The following attributes in the XSL format (fo) namespace are used
+ by OpenOffice.org but don't seem to be part of CSS. This may lead to
+ not 100% valid CSS.
* language
* country
* text-shadow
@@ -230,7 +250,10 @@
* break-before
* break-after
-->
- <xsl:value-of select="local-name()" /><xsl:text>:</xsl:text><xsl:value-of select="." /><xsl:text>; </xsl:text>
+ <xsl:value-of select="local-name()" />
+ <xsl:text>:</xsl:text>
+ <xsl:value-of select="." />
+ <xsl:text>; </xsl:text>
</xsl:template>
<xsl:template match="@fo:text-align" mode="style">
@@ -243,7 +266,9 @@
<!-- Style Attributes -->
<xsl:template match="@style:font-name" mode="style">
- <xsl:text>font-family:</xsl:text><xsl:value-of select="local-name()" /><xsl:text>; </xsl:text>
+ <xsl:text>font-family:</xsl:text>
+ <xsl:value-of select="local-name()" />
+ <xsl:text>; </xsl:text>
</xsl:template>
<xsl:template match="@style:text-underline" mode="style">
@@ -259,27 +284,39 @@
</xsl:template>
<xsl:template match="@style:text-background-color" mode="style">
- <xsl:text>background-color:</xsl:text><xsl:value-of select="." /><xsl:text>; </xsl:text>
+ <xsl:text>background-color:</xsl:text>
+ <xsl:value-of select="." />
+ <xsl:text>; </xsl:text>
</xsl:template>
<xsl:template match="@style:border-line-width" mode="style">
- <xsl:text>border-width:</xsl:text><xsl:value-of select="." /><xsl:text>; </xsl:text>
+ <xsl:text>border-width:</xsl:text>
+ <xsl:value-of select="." />
+ <xsl:text>; </xsl:text>
</xsl:template>
<xsl:template match="@style:border-line-width-top" mode="style">
- <xsl:text>border-top-width:</xsl:text><xsl:value-of select="." /><xsl:text>; </xsl:text>
+ <xsl:text>border-top-width:</xsl:text>
+ <xsl:value-of select="." />
+ <xsl:text>; </xsl:text>
</xsl:template>
<xsl:template match="@style:border-line-width-bottom" mode="style">
- <xsl:text>border-bottom-width:</xsl:text><xsl:value-of select="." /><xsl:text>; </xsl:text>
+ <xsl:text>border-bottom-width:</xsl:text>
+ <xsl:value-of select="." />
+ <xsl:text>; </xsl:text>
</xsl:template>
<xsl:template match="@style:border-line-width-left" mode="style">
- <xsl:text>border-left-width:</xsl:text><xsl:value-of select="." /><xsl:text>; </xsl:text>
+ <xsl:text>border-left-width:</xsl:text>
+ <xsl:value-of select="." />
+ <xsl:text>; </xsl:text>
</xsl:template>
<xsl:template match="@style:border-line-width-right" mode="style">
- <xsl:text>border-right-width:</xsl:text><xsl:value-of select="." /><xsl:text>; </xsl:text>
+ <xsl:text>border-right-width:</xsl:text>
+ <xsl:value-of select="." />
+ <xsl:text>; </xsl:text>
</xsl:template>
<!-- we need this, otherwise the processor will just print the attribute