Version 4.0.0.1, tag libreoffice-4.0.0.1
[LibreOffice.git] / xmerge / source / htmlsoff / sofftohtml.xsl
bloba596bf301e838f2e4ddeebf76a0a75b4163a3bcd
1 <?xml version="1.0" encoding="UTF-8"?>
2 <!--
3 * This file is part of the LibreOffice project.
5 * This Source Code Form is subject to the terms of the Mozilla Public
6 * License, v. 2.0. If a copy of the MPL was not distributed with this
7 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
9 * This file incorporates work covered by the following license notice:
11 * Licensed to the Apache Software Foundation (ASF) under one or more
12 * contributor license agreements. See the NOTICE file distributed
13 * with this work for additional information regarding copyright
14 * ownership. The ASF licenses this file to you under the Apache
15 * License, Version 2.0 (the "License"); you may not use this file
16 * except in compliance with the License. You may obtain a copy of
17 * the License at http://www.apache.org/licenses/LICENSE-2.0 .
18 -->
19 <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:style="http://openoffice.org/2000/style" xmlns:table="http://openoffice.org/2000/table" xmlns:text="http://openoffice.org/2000/text" xmlns:office="http://openoffice.org/2000/office" xmlns:fo="http://www.w3.org/1999/XSL/Format">
20 <xsl:output method="xml" omit-xml-declaration="yes" indent="yes" encoding="ISO-8859-1"/>
21 <!--doctype-system=[<!ENTITY acirc "">] -->
22 <xsl:strip-space elements="tokens"/>
23 <xsl:template match="office:document">
24 <html>
25 <xsl:apply-templates/>
26 </html>
27 </xsl:template>
28 <xsl:template match="office:document-content">
29 <html>
30 <xsl:apply-templates/>
31 </html>
32 </xsl:template>
33 <xsl:template match="office:automatic-styles">
34 <style type="text/css">p.Table-Heading{font-weight:bold;}<xsl:apply-templates/>
35 </style>
36 </xsl:template>
37 <xsl:template match="office:styles"/>
38 <xsl:template match="office:meta"/>
39 <xsl:template match="office:settings"/>
40 <xsl:template match="style:style">
41 <xsl:if test="@style:family ='paragraph'">p.<xsl:value-of select="@style:name"/>{<xsl:apply-templates/>}</xsl:if>
42 <xsl:if test="@style:family ='paragraph'">p.<xsl:value-of select="@style:name"/>{<xsl:if test="@style:parent-style-name='Table Heading'">font-weight:bold;font-style:italic;</xsl:if>
43 <xsl:apply-templates/>}</xsl:if>
44 <xsl:if test="@style:family ='table-cell'">td.<xsl:value-of select="@style:name"/>{<xsl:if test="@style:parent-style-name='Table Heading'">font-weight:bold;font-style:italic;</xsl:if>
45 <xsl:apply-templates/>}</xsl:if>
46 </xsl:template>
47 <xsl:template match="style:properties">
48 <!--<xsl:param name="style" select="@fo:font-weight"/>-->
49 <xsl:if test="@fo:font-weight">font-weight:<xsl:value-of select="@fo:font-weight"/>;</xsl:if>
50 <xsl:if test="@fo:font-style">font-style:<xsl:value-of select="@fo:font-style"/>;</xsl:if>
51 <xsl:if test="@style:font-name">font-family:<xsl:value-of select="@style:font-name"/>;</xsl:if>
52 <xsl:if test="@fo:font-size">font-size:<xsl:value-of select="@fo:font-size"/>;</xsl:if>
53 <xsl:if test="@style:text-underline='single'">text-decoration:underline;</xsl:if>
54 <xsl:if test="@style:text-crossing-out='single-line'">text-decoration:line-through;</xsl:if>
55 <xsl:if test="@fo:text-align='start'">text-align:left</xsl:if>
56 <xsl:if test="@fo:text-align='center'">text-align:center</xsl:if>
57 <xsl:if test="@fo:text-align='end'">text-align:right</xsl:if>
58 <!--<xsl:value-of select="$style"/>-->
59 </xsl:template>
60 <xsl:template match="office:body">
61 <xsl:apply-templates/>
62 </xsl:template>
63 <xsl:template match="table:table">
64 <table border="1" cellpadding="2" width="100%">
65 <xsl:apply-templates/>
66 </table>
67 </xsl:template>
68 <xsl:template match="table:table-header-rows">
69 <th>
70 <xsl:apply-templates/>
71 </th>
72 </xsl:template>
73 <xsl:template match="table:table-row">
74 <tr>
75 <xsl:apply-templates/>
76 </tr>
77 </xsl:template>
78 <xsl:template match="table:table-cell">
79 <xsl:text disable-output-escaping="yes">&lt;td class="</xsl:text>
80 <xsl:value-of select="@table:style-name"/>
81 <xsl:text disable-output-escaping="yes">"&gt;</xsl:text>
82 <!--<xsl:value-of select="."/>-->
83 <xsl:apply-templates/>
84 <xsl:text disable-output-escaping="yes">&lt;/td&gt;</xsl:text>
85 <!--<td width="20%">
86 <xsl:apply-templates />
87 </td>-->
88 </xsl:template>
89 <xsl:template match="text:p">
90 <xsl:if test="ancestor-or-self::table:table-cell">
91 <xsl:if test=".=''">
92 <br/>
93 </xsl:if>
94 </xsl:if>
95 <xsl:text disable-output-escaping="yes">&lt;p class="</xsl:text>
96 <xsl:choose>
97 <xsl:when test="@text:style-name ='Table Heading'">Table-Heading</xsl:when>
98 <xsl:otherwise>
99 <xsl:value-of select="@text:style-name"/>
100 </xsl:otherwise>
101 </xsl:choose>
102 <xsl:text disable-output-escaping="yes">"&gt;</xsl:text>
103 <xsl:apply-templates/>
104 <xsl:text disable-output-escaping="yes">&lt;/p&gt;</xsl:text>
105 <!--<xsl:value-of select="."/>-->
106 <!--<xsl:text disable-output-escaping="yes">&amp;nbsp;</xsl:text>-->
107 <!--<br/>-->
108 </xsl:template>
109 </xsl:stylesheet>