1<?xml version="1.0" encoding="UTF-8"?>
2<!--***********************************************************
3 *
4 * Licensed to the Apache Software Foundation (ASF) under one
5 * or more contributor license agreements.  See the NOTICE file
6 * distributed with this work for additional information
7 * regarding copyright ownership.  The ASF licenses this file
8 * to you under the Apache License, Version 2.0 (the
9 * "License"); you may not use this file except in compliance
10 * with the License.  You may obtain a copy of the License at
11 *
12 *   http://www.apache.org/licenses/LICENSE-2.0
13 *
14 * Unless required by applicable law or agreed to in writing,
15 * software distributed under the License is distributed on an
16 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
17 * KIND, either express or implied.  See the License for the
18 * specific language governing permissions and limitations
19 * under the License.
20 *
21 ***********************************************************-->
22
23
24<!--
25	For further documentation and updates visit http://xml.openoffice.org/odf2xhtml
26-->
27<xsl:stylesheet version="1.0"
28	xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
29	xmlns:chart="urn:oasis:names:tc:opendocument:xmlns:chart:1.0"
30	xmlns:config="urn:oasis:names:tc:opendocument:xmlns:config:1.0"
31	xmlns:dc="http://purl.org/dc/elements/1.1/"
32	xmlns:dom="http://www.w3.org/2001/xml-events"
33	xmlns:dr3d="urn:oasis:names:tc:opendocument:xmlns:dr3d:1.0"
34	xmlns:draw="urn:oasis:names:tc:opendocument:xmlns:drawing:1.0"
35	xmlns:fo="urn:oasis:names:tc:opendocument:xmlns:xsl-fo-compatible:1.0"
36	xmlns:form="urn:oasis:names:tc:opendocument:xmlns:form:1.0"
37	xmlns:math="http://www.w3.org/1998/Math/MathML"
38	xmlns:meta="urn:oasis:names:tc:opendocument:xmlns:meta:1.0"
39	xmlns:number="urn:oasis:names:tc:opendocument:xmlns:datastyle:1.0"
40	xmlns:office="urn:oasis:names:tc:opendocument:xmlns:office:1.0"
41	xmlns:ooo="http://openoffice.org/2004/office"
42	xmlns:oooc="http://openoffice.org/2004/calc"
43	xmlns:ooow="http://openoffice.org/2004/writer"
44	xmlns:script="urn:oasis:names:tc:opendocument:xmlns:script:1.0"
45	xmlns:style="urn:oasis:names:tc:opendocument:xmlns:style:1.0"
46	xmlns:svg="urn:oasis:names:tc:opendocument:xmlns:svg-compatible:1.0"
47	xmlns:table="urn:oasis:names:tc:opendocument:xmlns:table:1.0"
48	xmlns:text="urn:oasis:names:tc:opendocument:xmlns:text:1.0"
49	xmlns:xforms="http://www.w3.org/2002/xforms"
50	xmlns:xlink="http://www.w3.org/1999/xlink"
51	xmlns:xsd="http://www.w3.org/2001/XMLSchema"
52	xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
53	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"
54	xmlns="http://www.w3.org/1999/xhtml">
55
56
57	<!--+++++ INCLUDED XSL MODULES +++++-->
58
59	<!-- inheritance of office style properties is resolved into absolute styles. Office properties gathered as elements -->
60	<xsl:include href="../common/styles/style_collector.xsl" />
61
62	<!-- mapping rules of office style properties to CSS/HTML properties -->
63	<xsl:include href="../common/styles/style_mapping_css.xsl" />
64
65	<!-- office header element handling especially for XHTML -->
66	<xsl:include href="header.xsl" />
67
68	<!-- office body element handling especially for XHTML -->
69	<xsl:include href="body.xsl" />
70
71
72	<xsl:output method               = "xml"
73				encoding             = "UTF-8"
74				media-type           = "application/xhtml+xml"
75				indent               = "no"
76				omit-xml-declaration = "no"
77				doctype-public       = "-//W3C//DTD XHTML 1.1 plus MathML 2.0//EN"
78				doctype-system       = "http://www.w3.org/Math/DTD/mathml2/xhtml-math11-f.dtd" />
79
80
81
82	<xsl:variable name="namespace" select="'http://www.w3.org/1999/xhtml'" />
83
84	<!--+++++ PARAMETER SECTION +++++-->
85
86	<!-- OPTIONAL: if the document content is provided in a directory structure. Opposite to a single flat XML stream -->
87	<xsl:param name="isPackageFormat" />
88
89	<!-- OPTIONAL: (MANDATORY: for all input document with relative external links): parameter is a absolute file URL to the target directory.
90		 Relative links from the office document (e.g. to external graphics) will get this parameter as a prefix -->
91	<xsl:param name="targetBaseURL" select="'./'" />
92
93	<!-- OPTIONAL: (MANDATORY: for all input document with content table) : parameter is a absolute file URL to the target document.
94		 Relative links to this office document (e.g. to internal anchor) will get this parameter as a prefix -->
95	<xsl:param name="targetURL" select="'./'" />
96
97	<!-- OPTIONAL: (MANDATORY: for input document with relative internal links)
98		 To access contents of a office file (content like the meta.xml, styles.xml file or  graphics) a URL could be choosen.
99	 This could be even a JAR URL. The sourceBase of the content URL "jar:file:/C:/temp/Test.sxw!/content.xml" would be
100	 "jar:file:/C:/temp/Test.sxw!/" for example.
101		 When working with OpenOffice API a Package-URL encoded over HTTP can be used to access the jared contents of the the jared document. -->
102	<xsl:param name="sourceBaseURL" select="'./'" />
103
104	<!-- OPTIONAL: (MANDATORY: for session management by URL rewriting)
105		 Useful for WebApplications: if a HTTP session is not cookie based, URL rewriting is beeing used (the session is appended to the URL).
106		 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. -->
107	<xsl:param name="optionalURLSuffix" />
108
109	<!-- OPTIONAL: URL to office meta file (flat xml use the URL to the input file) -->
110	<xsl:param name="metaFileURL" />
111
112	<!-- OPTIONAL: URL to office meta file (flat xml use the URL to the input file) -->
113	<xsl:param name="stylesFileURL" />
114
115	<!-- OPTIONAL: DPI (dots per inch) the standard resolution of given pictures (necessary for the conversion of 'cm' into 'pixel')-->
116	<!-- Although many pictures have a 96 dpi resolution, a higher resoltion give better results for common browsers -->
117	<!-- Cp. measure_conversion.xsl:
118		 <xsl:param name="dpi" select="111" /> -->
119
120
121	<!-- OPTIONAL: in case of using a different processor than a JAVA XSLT, you can unable the Java functionality
122		 (e.g. encoding chapter names for the content-table as href and anchors ) -->
123	<xsl:param name="java"        select="true()" />
124	<xsl:param name="javaEnabled" select="boolean($java)" />
125
126	<!-- OPTIONAL: for activating the debug mode set the variable here to 'true()' or give any value from outside -->
127	<xsl:param name="debug"                    select="false()" />
128	<xsl:param name="debugEnabled"             select="boolean($debug)" />
129	<xsl:param name="onlyStyleOutput"          select="false()" />
130	<xsl:param name="onlyStyleOutputEnabled"   select="boolean($onlyStyleOutput)" />
131
132	<!-- ************************************* -->
133	<!-- *** build the propriate HTML file *** -->
134	<!-- ************************************* -->
135	<xsl:template match="/">
136		<!-- debug output of parameter value set -->
137		<xsl:if test="$debugEnabled">
138			<xsl:call-template name="debug-check-paramter" />
139		</xsl:if>
140		<!-- gathers style properties and
141			returns them as globalData parameter to the 'start-main' template            -->
142		<xsl:call-template name="collect-global-odf-properties" />
143	</xsl:template>
144
145
146	<!-- *************************** -->
147	<!-- *** Built up XHTML file *** -->
148	<!-- *************************** -->
149	<xsl:template name="start-main">
150		<xsl:param name="globalData" />
151
152		<xsl:element name="html">
153			<xsl:comment>This file was converted to xhtml by OpenOffice.org - see http://xml.openoffice.org/odf2xhtml for more info.</xsl:comment>
154			<xsl:call-template name='create-header'>
155				<xsl:with-param name="globalData" select="$globalData" />
156			</xsl:call-template>
157
158			<xsl:call-template name='create-body'>
159				<xsl:with-param name="globalData" select="$globalData" />
160			</xsl:call-template>
161		</xsl:element>
162	</xsl:template>
163
164
165	<!-- debug purpose only:
166		 verbose checking of the parameters of this template-->
167	<xsl:template name="debug-check-paramter">
168		<xsl:message>Parameter dpi: <xsl:value-of select="$dpi" /></xsl:message>
169		<xsl:message>Parameter metaFileURL: <xsl:value-of select="$metaFileURL" /></xsl:message>
170		<xsl:message>Parameter stylesFileURL: <xsl:value-of select="$stylesFileURL" /></xsl:message>
171		<xsl:message>Parameter sourceBaseURL: <xsl:value-of select="$sourceBaseURL" /></xsl:message>
172		<xsl:message>Parameter targetBaseURL: <xsl:value-of select="$targetBaseURL" /></xsl:message>
173		<xsl:message>Parameter onlyStyleOutputEnabled: <xsl:value-of select="$onlyStyleOutputEnabled" /></xsl:message>
174		<xsl:message>Parameter debugEnabled: <xsl:value-of select="$debugEnabled" /></xsl:message>
175		<xsl:message>Parameter java: <xsl:value-of select="$java" /></xsl:message>
176		<xsl:message>Parameter javaEnabled: <xsl:value-of select="$javaEnabled" /></xsl:message>
177	</xsl:template>
178
179</xsl:stylesheet>
180