1
<?xml version="1.0" encoding="UTF-8"?>
4
DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
6
Copyright 2008 by Sun Microsystems, Inc.
8
OpenOffice.org - a multi-platform office productivity suite
10
$RCSfile: opendoc2xhtml.xsl,v $
14
This file is part of OpenOffice.org.
16
OpenOffice.org is free software: you can redistribute it and/or modify
17
it under the terms of the GNU Lesser General Public License version 3
18
only, as published by the Free Software Foundation.
20
OpenOffice.org is distributed in the hope that it will be useful,
21
but WITHOUT ANY WARRANTY; without even the implied warranty of
22
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
23
GNU Lesser General Public License version 3 for more details
24
(a copy is included in the LICENSE file that accompanied this code).
26
You should have received a copy of the GNU Lesser General Public License
27
version 3 along with OpenOffice.org. If not, see
28
<http://www.openoffice.org/license.html>
29
for a copy of the LGPLv3 License.
33
For further documentation and updates visit http://xml.openoffice.org/odf2xhtml
35
<xsl:stylesheet version="1.0"
36
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
37
xmlns:chart="urn:oasis:names:tc:opendocument:xmlns:chart:1.0"
38
xmlns:config="urn:oasis:names:tc:opendocument:xmlns:config:1.0"
39
xmlns:dc="http://purl.org/dc/elements/1.1/"
40
xmlns:dom="http://www.w3.org/2001/xml-events"
41
xmlns:dr3d="urn:oasis:names:tc:opendocument:xmlns:dr3d:1.0"
42
xmlns:draw="urn:oasis:names:tc:opendocument:xmlns:drawing:1.0"
43
xmlns:fo="urn:oasis:names:tc:opendocument:xmlns:xsl-fo-compatible:1.0"
44
xmlns:form="urn:oasis:names:tc:opendocument:xmlns:form:1.0"
45
xmlns:math="http://www.w3.org/1998/Math/MathML"
46
xmlns:meta="urn:oasis:names:tc:opendocument:xmlns:meta:1.0"
47
xmlns:number="urn:oasis:names:tc:opendocument:xmlns:datastyle:1.0"
48
xmlns:office="urn:oasis:names:tc:opendocument:xmlns:office:1.0"
49
xmlns:ooo="http://openoffice.org/2004/office"
50
xmlns:oooc="http://openoffice.org/2004/calc"
51
xmlns:ooow="http://openoffice.org/2004/writer"
52
xmlns:script="urn:oasis:names:tc:opendocument:xmlns:script:1.0"
53
xmlns:style="urn:oasis:names:tc:opendocument:xmlns:style:1.0"
54
xmlns:svg="urn:oasis:names:tc:opendocument:xmlns:svg-compatible:1.0"
55
xmlns:table="urn:oasis:names:tc:opendocument:xmlns:table:1.0"
56
xmlns:text="urn:oasis:names:tc:opendocument:xmlns:text:1.0"
57
xmlns:xforms="http://www.w3.org/2002/xforms"
58
xmlns:xlink="http://www.w3.org/1999/xlink"
59
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
60
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
61
exclude-result-prefixes="chart config dc dom dr3d draw fo form math meta number office ooo oooc ooow script style svg table text xforms xlink xsd xsi xforms xsd xsi"
62
xmlns="http://www.w3.org/1999/xhtml">
65
<!--+++++ INCLUDED XSL MODULES +++++-->
67
<!-- inheritance of office style properties is resolved into absolute styles. Office properties gathered as elements -->
68
<xsl:include href="../xml.files/odt/export/common/styles/style_collector.xsl" />
70
<!-- mapping rules of office style properties to CSS/HTML properties -->
71
<xsl:include href="../xml.files/odt/export/common/styles/style_mapping_css.xsl" />
73
<!-- office header element handling especially for XHTML -->
74
<xsl:include href="../xml.files/odt/export/xhtml/header.xsl" />
76
<!-- office body element handling especially for XHTML -->
77
<xsl:include href="../xml.files/odt/export/xhtml/body.xsl" />
80
<xsl:output method = "xml"
82
media-type = "application/xhtml+xml"
84
omit-xml-declaration = "no"
85
doctype-public = "-//W3C//DTD XHTML 1.1 plus MathML 2.0//EN"
86
doctype-system = "http://www.w3.org/TR/MathML2/dtd/xhtml-math11-f.dtd" />
90
<xsl:variable name="namespace" select="'http://www.w3.org/1999/xhtml'" />
92
<!--+++++ PARAMETER SECTION +++++-->
94
<!-- OPTIONAL: if the document content is provided in a directory structure. Opposite to a single flat XML stream -->
95
<xsl:param name="isPackageFormat" />
97
<!-- OPTIONAL: (MANDATORY: for all input document with relative external links): parameter is a absolute file URL to the target directory.
98
Relative links from the office document (e.g. to external graphics) will get this parameter as a prefix -->
99
<xsl:param name="targetBaseURL" select="'./'" />
101
<!-- OPTIONAL: (MANDATORY: for all input document with content table) : parameter is a absolute file URL to the target document.
102
Relative links to this office document (e.g. to internal anchor) will get this parameter as a prefix -->
103
<xsl:param name="targetURL" select="'./'" />
105
<!-- OPTIONAL: (MANDATORY: for input document with relative internal links)
106
To access contents of a office file (content like the meta.xml, styles.xml file or graphics) a URL could be choosen.
107
This could be even a JAR URL. The sourceBase of the content URL "jar:file:/C:/temp/Test.sxw!/content.xml" would be
108
"jar:file:/C:/temp/Test.sxw!/" for example.
109
When working with OpenOffice API a Package-URL encoded over HTTP can be used to access the jared contents of the the jared document. -->
110
<xsl:param name="sourceBaseURL" select="'./'" />
112
<!-- OPTIONAL: (MANDATORY: for session management by URL rewriting)
113
Useful for WebApplications: if a HTTP session is not cookie based, URL rewriting is beeing used (the session is appended to the URL).
114
This URL session is used for example when links to graphics are created by XSLT. Otherwise the user havt to log again in for every graphic he liks to see. -->
115
<xsl:param name="optionalURLSuffix" />
117
<!-- OPTIONAL: URL to office meta file (flat xml use the URL to the input file) -->
118
<xsl:param name="metaFileURL" />
120
<!-- OPTIONAL: URL to office meta file (flat xml use the URL to the input file) -->
121
<xsl:param name="stylesFileURL" />
123
<!-- OPTIONAL: DPI (dots per inch) the standard resolution of given pictures (necessary for the conversion of 'cm' into 'pixel')-->
124
<!-- Although many pictures have a 96 dpi resolution, a higher resoltion give better results for common browsers -->
125
<!-- Cp. measure_conversion.xsl:
126
<xsl:param name="dpi" select="111" /> -->
129
<!-- OPTIONAL: in case of using a different processor than a JAVA XSLT, you can unable the Java functionality
130
(e.g. encoding chapter names for the content-table as href and anchors ) -->
131
<xsl:param name="java" select="true()" />
132
<xsl:param name="javaEnabled" select="boolean($java)" />
134
<!-- OPTIONAL: for activating the debug mode set the variable here to 'true()' or give any value from outside -->
135
<xsl:param name="debug" select="false()" />
136
<xsl:param name="debugEnabled" select="boolean($debug)" />
137
<xsl:param name="onlyStyleOutput" select="false()" />
138
<xsl:param name="onlyStyleOutputEnabled" select="boolean($onlyStyleOutput)" />
140
<!-- ************************************* -->
141
<!-- *** build the propriate HTML file *** -->
142
<!-- ************************************* -->
143
<xsl:template match="/">
144
<!-- debug output of parameter value set -->
145
<xsl:if test="$debugEnabled">
146
<xsl:call-template name="debug-check-paramter" />
148
<!-- gathers style properties and
149
returns them as globalData parameter to the 'start-main' template -->
150
<xsl:call-template name="collect-global-odf-properties" />
154
<!-- *************************** -->
155
<!-- *** Built up XHTML file *** -->
156
<!-- *************************** -->
157
<xsl:template name="start-main">
158
<xsl:param name="globalData" />
160
<xsl:element name="html">
161
<xsl:comment>This file was converted to xhtml by OpenOffice.org - see http://xml.openoffice.org/odf2xhtml for more info.</xsl:comment>
162
<xsl:call-template name='create-header'>
163
<xsl:with-param name="globalData" select="$globalData" />
166
<xsl:call-template name='create-body'>
167
<xsl:with-param name="globalData" select="$globalData" />
173
<!-- debug purpose only:
174
verbose checking of the parameters of this template-->
175
<xsl:template name="debug-check-paramter">
176
<xsl:message>Parameter dpi: <xsl:value-of select="$dpi" /></xsl:message>
177
<xsl:message>Parameter metaFileURL: <xsl:value-of select="$metaFileURL" /></xsl:message>
178
<xsl:message>Parameter stylesFileURL: <xsl:value-of select="$stylesFileURL" /></xsl:message>
179
<xsl:message>Parameter sourceBaseURL: <xsl:value-of select="$sourceBaseURL" /></xsl:message>
180
<xsl:message>Parameter targetBaseURL: <xsl:value-of select="$targetBaseURL" /></xsl:message>
181
<xsl:message>Parameter onlyStyleOutputEnabled: <xsl:value-of select="$onlyStyleOutputEnabled" /></xsl:message>
182
<xsl:message>Parameter debugEnabled: <xsl:value-of select="$debugEnabled" /></xsl:message>
183
<xsl:message>Parameter java: <xsl:value-of select="$java" /></xsl:message>
184
<xsl:message>Parameter javaEnabled: <xsl:value-of select="$javaEnabled" /></xsl:message>