/usr/share/kde4/apps/words/html-odf/converter.xsl is in calligrawords-data 1:2.4.0-0ubuntu2.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 | <?xml version="1.0" encoding="UTF-8"?>
<!--
This file is part of the Calligra project
Copyright (C) 2010 Pramod S G <pramod.xyle@gmail.com>
Copyright (C) 2010 Srihari Prasad G V <sri-hari@live.com>
Copyright (C) 2011 Stuart Dickson <stuart@kogmbh.com>
This library is free software; you can redistribute it and/or
modify it under the terms of the Library GNU General Public
version 2 of the License, or (at your option) version 3 or,
at the discretion of KDE e.V (which shall act as a proxy as in
section 14 of the GPLv3), any later version..
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Library General Public License for more details.
You should have received a copy of the GNU Library General Public License
along with this library; see the file COPYING.LIB. If not, write to
the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
Boston, MA 02110-1301, USA.
-->
<xsl:stylesheet xmlns:office="urn:oasis:names:tc:opendocument:xmlns:office:1.0"
xmlns:meta="urn:oasis:names:tc:opendocument:xmlns:meta:1.0"
xmlns:config="urn:oasis:names:tc:opendocument:xmlns:config:1.0"
xmlns:text="urn:oasis:names:tc:opendocument:xmlns:text:1.0"
xmlns:table="urn:oasis:names:tc:opendocument:xmlns:table:1.0"
xmlns:draw="urn:oasis:names:tc:opendocument:xmlns:drawing:1.0"
xmlns:presentation="urn:oasis:names:tc:opendocument:xmlns:presentation:1.0"
xmlns:dr3d="urn:oasis:names:tc:opendocument:xmlns:dr3d:1.0"
xmlns:chart="urn:oasis:names:tc:opendocument:xmlns:chart:1.0"
xmlns:form="urn:oasis:names:tc:opendocument:xmlns:form:1.0"
xmlns:script="urn:oasis:names:tc:opendocument:xmlns:script:1.0"
xmlns:style="urn:oasis:names:tc:opendocument:xmlns:style:1.0"
xmlns:number="urn:oasis:names:tc:opendocument:xmlns:datastyle:1.0"
xmlns:anim="urn:oasis:names:tc:opendocument:xmlns:animation:1.0"
xmlns:dc="http://purl.org/dc/elements/1.1/"
xmlns:xlink="http://www.w3.org/1999/xlink"
xmlns:math="http://www.w3.org/1998/Math/MathML"
xmlns:xforms="http://www.w3.org/2002/xforms"
xmlns:fo="urn:oasis:names:tc:opendocument:xmlns:xsl-fo-compatible:1.0"
xmlns:svg="urn:oasis:names:tc:opendocument:xmlns:svg-compatible:1.0"
xmlns:smil="urn:oasis:names:tc:opendocument:xmlns:smil-compatible:1.0"
xmlns:ooo="http://openoffice.org/2004/office"
xmlns:ooow="http://openoffice.org/2004/writer"
xmlns:oooc="http://openoffice.org/2004/calc"
xmlns:int="http://opendocumentfellowship.org/internal"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
version="2.0">
<xsl:param xmlns:dom="http://www.w3.org/2001/xml-events" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" name="param_no_css"/>
<xsl:param xmlns:dom="http://www.w3.org/2001/xml-events" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" name="param_css_only"/>
<xsl:param xmlns:dom="http://www.w3.org/2001/xml-events" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" name="scale">1</xsl:param>
<xsl:param xmlns:dom="http://www.w3.org/2001/xml-events" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" name="style.background-color">#F0F0F0</xsl:param>
<xsl:param xmlns:dom="http://www.w3.org/2001/xml-events" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" name="CSS.debug">0</xsl:param>
<xsl:variable xmlns:dom="http://www.w3.org/2001/xml-events" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" name="linebreak"> </xsl:variable>
<xsl:output method="xml" indent="yes" omit-xml-declaration="yes"/>
<xsl:template match="office:document">
<xsl:apply-templates/>
</xsl:template>
<xsl:template match="/office:document">
<xsl:element name="html">
<xsl:element name="head">
<!-- meta must be first -->
<xsl:apply-templates select="office:document-meta"/>
<!-- must be second -->
<xsl:element name="style">
<xsl:apply-templates select="office:document-styles"/>
</xsl:element>
</xsl:element>
<!-- body must be after head -->
<xsl:element name="body">
<xsl:apply-templates select="office:document-styles/office:master-styles/style:master-page/style:header"/>
<xsl:apply-templates select="office:document-content"/>
<xsl:apply-templates select="office:document-styles/office:master-styles/style:master-page/style:footer"/>
</xsl:element>
</xsl:element>
</xsl:template>
<xsl:template match="office:document-meta">
<xsl:apply-templates/>
</xsl:template>
<xsl:template match="office:meta">
<xsl:comment>office:metadata begin</xsl:comment>
<xsl:apply-templates select="dc:title"/>
<xsl:apply-templates select="dc:creator"/>
<xsl:apply-templates select="dc:date"/>
<xsl:apply-templates select="dc:language"/>
<xsl:apply-templates select="dc:description"/>
<xsl:apply-templates select="meta:keyword"/>
<xsl:apply-templates select="meta:generator"/>
<meta http-equiv="Content-Type" content="application/xhtml+xml;charset=utf-8"/>
<xsl:comment>office:metadata end</xsl:comment>
</xsl:template>
<!-- Without care, the XSLT would output <title/> for an empty title, which is incorrectly
parsed by many modern browsers.
To ensure that some value for title is defined, if it is not set in the document,
we write the filename into the title.
-->
<xsl:template match="dc:title">
<xsl:element name="title">
<xsl:choose>
<xsl:when test="current()!=''">
<xsl:apply-templates/>
</xsl:when>
<xsl:otherwise>
<xsl:value-of select="$html-odf-fileName"/>
</xsl:otherwise>
</xsl:choose>
</xsl:element>
</xsl:template>
<xsl:template match="dc:language">
<meta http-equiv="content-language" content="{current()}"/>
</xsl:template>
<xsl:template match="dc:creator">
<meta name="author" content="{current()}"/>
<meta name="DC.creator" content="{current()}"/>
</xsl:template>
<xsl:template match="dc:description">
<meta name="description" content="{current()}"/>
</xsl:template>
<xsl:template match="dc:date">
<meta name="revised" content="{current()}"/>
<meta name="DC.date" content="{current()}"/>
</xsl:template>
<xsl:template match="meta:keyword">
<meta name="keywords" content="{current()}"/>
</xsl:template>
<xsl:template match="meta:generator">
<meta name="generator" content="{current()}"/>
</xsl:template>
<xsl:template name="office:document-styles">
html
{
font-family: Verdana, SunSans-Regular, Sans-Serif;
font-size: <xsl:value-of select="$scale * 14"/>pt;
}
@media print
{
html
{
}
}
@media screen
{
html
{
background-color: <xsl:value-of select="$style.background-color"/>;
margin: 1.5em;
}
body
{
max-width: 40em;
margin:0 auto; /* center document content */
}
}
table
{
border: thin solid gray;
border-collapse: collapse;
empty-cells: show;
}
td
{
border: thin solid gray;
vertical-align: bottom;
}
.cell_string
{
text-align: left;
}
.cell_time
{
text-align: right;
}
td p:hover
{
max-height: none;
}
.page-break
{
margin: 1em;
}
</xsl:template>
<xsl:template match="office:document-styles">
<!-- office:document-styles begin -->
<xsl:call-template name="office:document-styles" />
<xsl:apply-templates/>
<!-- office:document-styles end -->
</xsl:template>
<xsl:template match="office:styles">
<xsl:text><!-- office:styles begin --></xsl:text>
<xsl:apply-templates />
<xsl:text><!-- office:styles end --></xsl:text>
</xsl:template>
<xsl:template match="office:automatic-styles">
<xsl:text><!-- office:automatic-styles begin1 --></xsl:text>
<xsl:apply-templates/>
<xsl:text><!-- office:automatic-styles end --></xsl:text>
</xsl:template>
<xsl:template match="style:default-style">
<xsl:text>p{</xsl:text>
<xsl:text>}</xsl:text>
</xsl:template>
<xsl:template match="office:styles/style:style">
<xsl:text>.</xsl:text><xsl:value-of select="@style:family"></xsl:value-of><xsl:text>_</xsl:text>
<xsl:value-of select="@style:name"></xsl:value-of>
<xsl:text>
{</xsl:text>
<xsl:apply-templates/>
<xsl:text>}
</xsl:text>
</xsl:template>
<xsl:template match="office:styles/style:paragraph-properties">
<xsl:text> padding-top:</xsl:text>
<xsl:value-of select="@fo:padding-top"></xsl:value-of><xsl:text>; </xsl:text>
<xsl:text> font-size:</xsl:text>
<xsl:value-of select="@fo:font-size"></xsl:value-of><xsl:text>; </xsl:text>
</xsl:template>
<xsl:template match="office:styles/style:text-properties">
<xsl:text> font-size:</xsl:text>
<xsl:value-of select="@fo:font-size"></xsl:value-of><xsl:text>; </xsl:text>
<xsl:text> font-weight:</xsl:text>
<xsl:value-of select="@fo:font-weight"></xsl:value-of><xsl:text>; </xsl:text>
<xsl:text> font-family:</xsl:text>
<xsl:value-of select="@fo:font-family"></xsl:value-of><xsl:text>; </xsl:text>
<xsl:text> font-style:</xsl:text>
<xsl:value-of select="@fo:font-style"></xsl:value-of><xsl:text>; </xsl:text>
</xsl:template>
<xsl:template match="office:document-content">
<xsl:apply-templates/>
</xsl:template>
<xsl:template match="office:body">
<xsl:apply-templates/>
</xsl:template>
<xsl:template match="office:text">
<xsl:apply-templates/>
</xsl:template>
<xsl:template match="text:p">
<xsl:element name="p">
<xsl:apply-templates/>
</xsl:element>
</xsl:template>
<xsl:template match="text:span[@text:style-name='T1']">
<xsl:element name="strong">
<xsl:apply-templates/>
</xsl:element>
</xsl:template>
<xsl:template match="text:span">
<xsl:apply-templates/>
</xsl:template>
<xsl:template match="table:table-columns">
<xsl:apply-templates />
</xsl:template>
<!-- table headers need to be processed slightly differtly in order to output <th> elements
instead of <td> elements. As both <table-header-rows> and <table-row> contain
<table-cell> elements, we need to set a "table_header" mode to apply the appropriate
template
-->
<xsl:template match="table:table-header-rows">
<xsl:element name="thead">
<xsl:for-each select="table:table-row">
<xsl:element name="tr">
<xsl:apply-templates mode="table_header" />
</xsl:element>
</xsl:for-each>
</xsl:element>
</xsl:template>
<!-- Regular table row -->
<xsl:template match="table:table-row">
<xsl:element name="tr">
<xsl:apply-templates />
</xsl:element>
</xsl:template>
<!-- Table cell inside a table header -->
<xsl:template match="table:table-cell" mode="table_header">
<xsl:element name="th">
<xsl:if test="string(@table:number-columns-spanned)">
<xsl:attribute name="colspan">
<xsl:value-of select="@table:number-columns-spanned" />
</xsl:attribute>
</xsl:if>
<xsl:if test="string(@table:number-rows-spanned)">
<xsl:attribute name="rowspan">
<xsl:value-of select="@table:number-rows-spanned" />
</xsl:attribute>
</xsl:if>
<xsl:apply-templates select="text:p"/>
</xsl:element>
</xsl:template>
<!-- Regular table cell -->
<xsl:template match="table:table-cell">
<xsl:element name="td">
<xsl:if test="string(@table:number-columns-spanned)">
<xsl:attribute name="colspan">
<xsl:value-of select="@table:number-columns-spanned" />
</xsl:attribute>
</xsl:if>
<xsl:if test="string(@table:number-rows-spanned)">
<xsl:attribute name="rowspan">
<xsl:value-of select="@table:number-rows-spanned" />
</xsl:attribute>
</xsl:if>
<xsl:apply-templates select="text:p"/>
</xsl:element>
</xsl:template>
<xsl:template match="table:table">
<table border="1">
<xsl:value-of select="$linebreak"/>
<xsl:apply-templates />
</table>
</xsl:template>
<!-- Images -->
<xsl:template match="draw:frame">
<xsl:apply-templates/>
</xsl:template>
<xsl:template match="draw:image">
<img src="{$html-odf-resourcesPath}/{@xlink:href}"/>
</xsl:template>
<!--
We may need to remove non-printing character sequence EF BF BC (0xfffc)
This is a UTF-8 encoding for QChar::ObjectRepalcementMarker
-->
<xsl:template match="text()">
<xsl:value-of select="replace(.,'\xEF\xBF\xBC','')"/>
</xsl:template>
</xsl:stylesheet>
|