/xmlbench/trunk

To get this branch, use:
bzr branch http://darksoft.org/webbzr/xmlbench/trunk

« back to all changes in this revision

Viewing changes to xml.files/odt/export/xhtml/header.xsl

  • Committer: Suren A. Chilingaryan
  • Date: 2009-02-16 09:27:17 UTC
  • Revision ID: csa@dside.dyndns.org-20090216092717-wipyvaaw2srxhgns
Initial import

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
<?xml version="1.0" encoding="UTF-8"?>
 
2
<!--
 
3
 
 
4
  DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
 
5
  
 
6
  Copyright 2008 by Sun Microsystems, Inc.
 
7
 
 
8
  OpenOffice.org - a multi-platform office productivity suite
 
9
 
 
10
  $RCSfile: header.xsl,v $
 
11
 
 
12
  $Revision: 1.2.62.1 $
 
13
 
 
14
  This file is part of OpenOffice.org.
 
15
 
 
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.
 
19
 
 
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).
 
25
 
 
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.
 
30
 
 
31
-->
 
32
<!--
 
33
        For further documentation and updates visit http://xml.openoffice.org/odf2xhtml
 
34
-->
 
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">
 
63
 
 
64
 
 
65
        <!-- ************** -->
 
66
        <!-- *** header *** -->
 
67
        <!-- ************** -->
 
68
 
 
69
        <xsl:template name="create-header">
 
70
                <xsl:param name="globalData" />
 
71
 
 
72
                <xsl:element name="head">
 
73
                <xsl:attribute name="profile">http://dublincore.org/documents/dcmi-terms/</xsl:attribute>
 
74
                        <xsl:if test="$debugEnabled"><xsl:message>CSS helper variable will be created....</xsl:message></xsl:if>
 
75
                        <xsl:call-template name='xhtml-header-properties'>
 
76
                                <xsl:with-param name="globalData" select="$globalData" />
 
77
                        </xsl:call-template>
 
78
 
 
79
                        <xsl:if test="$debugEnabled"><xsl:message>CSS variable ready, header will be created....</xsl:message></xsl:if>
 
80
                        <!-- constructing the css header simulating inheritance of style-families by style order -->
 
81
                        <xsl:call-template name='create-css-styleheader'>
 
82
                                <xsl:with-param name="globalData" select="$globalData" />
 
83
                        </xsl:call-template>
 
84
                        <xsl:if test="$debugEnabled"><xsl:message>CSS header creation finished!</xsl:message></xsl:if>
 
85
                </xsl:element>
 
86
 
 
87
        </xsl:template>
 
88
 
 
89
 
 
90
        <!-- Creating a CSS style header from the collected styles of the 'globalData' parameter -->
 
91
        <xsl:template name='create-css-styleheader'>
 
92
                <xsl:param name="globalData" />
 
93
 
 
94
                <xsl:element name="style">
 
95
                        <xsl:attribute name="type">text/css</xsl:attribute>
 
96
<xsl:text>
 
97
        </xsl:text>
 
98
        <xsl:call-template name='create-page-layout'>
 
99
                <xsl:with-param name="globalData" select="$globalData" />
 
100
        </xsl:call-template>
 
101
<xsl:text>table { border-collapse:collapse; border-spacing:0; empty-cells:show }
 
102
        </xsl:text>
 
103
        <xsl:choose>
 
104
                <xsl:when test="/*/office:body/office:spreadsheet"><xsl:text>td, th { vertical-align:top; font-size:10pt;}
 
105
        </xsl:text></xsl:when>
 
106
                <xsl:otherwise><xsl:text>td, th { vertical-align:top; font-size:12pt;}
 
107
        </xsl:text></xsl:otherwise>
 
108
        </xsl:choose>
 
109
<xsl:text>h1, h2, h3, h4, h5, h6 { clear:both }
 
110
        </xsl:text>
 
111
<xsl:text>ol, ul { margin:0; padding:0;}
 
112
        </xsl:text>
 
113
<xsl:text>li { list-style: none; margin:0; padding:0;}
 
114
        </xsl:text>
 
115
<xsl:text>li span.odfLiEnd { clear: both; line-height:0; width:0; height:0; margin:0; padding:0; }
 
116
        </xsl:text>
 
117
<xsl:text>span.footnodeNumber { padding-right:1em; }
 
118
        </xsl:text>
 
119
<xsl:text>* { margin:0; }
 
120
        </xsl:text>
 
121
                        <xsl:call-template name="write-mapped-CSS-styles">
 
122
                                <xsl:with-param name="globalData" select="$globalData" />
 
123
                        </xsl:call-template>
 
124
                </xsl:element>
 
125
        </xsl:template>
 
126
 
 
127
        <xsl:template name="write-mapped-CSS-styles">
 
128
                <xsl:param name="globalData" />
 
129
                <xsl:param name="styleNo" select="1"/>
 
130
                <xsl:param name="emptyStyles"/>
 
131
 
 
132
                <xsl:choose>
 
133
                        <xsl:when test="$globalData/all-styles/style[$styleNo]">
 
134
                        <!-- If there is still a style to be written -->
 
135
                                <!-- setting the context -->
 
136
                                <xsl:for-each select="$globalData/all-styles/style[$styleNo]">
 
137
                                <xsl:choose>
 
138
                                        <xsl:when test="final-properties != ''">
 
139
                                        <!-- NOTE: easy process, as only the style family in conjunction with the style name, makes the style unambigous -->
 
140
                                <xsl:text>.</xsl:text><!--<xsl:value-of select="@style:family" /><xsl:text>:</xsl:text>--><xsl:value-of select="translate(@style:name, '.,;: %()[]/\+', '_____________')"/><xsl:text> { </xsl:text> <xsl:value-of select="final-properties" /><xsl:text>}
 
141
        </xsl:text>
 
142
                                                <xsl:call-template name="write-mapped-CSS-styles">
 
143
                                                        <xsl:with-param name="globalData" select="$globalData" />
 
144
                                                        <xsl:with-param name="emptyStyles" select="$emptyStyles"/>
 
145
                                                        <xsl:with-param name="styleNo" select="$styleNo + 1"/>
 
146
                                                </xsl:call-template>
 
147
                                        </xsl:when>
 
148
                                        <xsl:otherwise>
 
149
                                                <xsl:call-template name="write-mapped-CSS-styles">
 
150
                                                        <xsl:with-param name="globalData" select="$globalData" />
 
151
                                                        <xsl:with-param name="emptyStyles" select="concat($emptyStyles, '.', @style:name, ' ')"/>
 
152
                                                        <xsl:with-param name="styleNo" select="$styleNo + 1"/>
 
153
                                                </xsl:call-template>
 
154
                                        </xsl:otherwise>
 
155
                                </xsl:choose>
 
156
                                </xsl:for-each>
 
157
                        </xsl:when>
 
158
                        <xsl:otherwise>
 
159
                        <!-- Otherwise all styles have been processed and the empty styles have to be given out -->
 
160
                                <xsl:comment> ODF styles with no properties representable as CSS </xsl:comment><xsl:text>
 
161
        </xsl:text><xsl:value-of select="$emptyStyles"/><xsl:text>{ }
 
162
        </xsl:text>
 
163
                        </xsl:otherwise>
 
164
                </xsl:choose>
 
165
        </xsl:template>
 
166
 
 
167
 
 
168
        <!-- Creating CSS page layout based on first office master style -->
 
169
        <xsl:template name='create-page-layout'>
 
170
                <xsl:param name="globalData" />
 
171
 
 
172
<xsl:text>@page { </xsl:text>
 
173
 
 
174
                <xsl:call-template name="page-size">
 
175
                        <xsl:with-param name="globalData"   select="$globalData" />
 
176
                </xsl:call-template>
 
177
                <xsl:call-template name="page-margin">
 
178
                        <xsl:with-param name="globalData"   select="$globalData" />
 
179
                </xsl:call-template>
 
180
 
 
181
<xsl:text> }
 
182
        </xsl:text>
 
183
 
 
184
        </xsl:template>
 
185
 
 
186
 
 
187
        <xsl:template name="page-size">
 
188
                <xsl:param name="globalData" />
 
189
 
 
190
                <!-- approximation as attribute belongs to a page style, which won't work in XHTML -->
 
191
                <xsl:variable name="pageProperties" select="$globalData/styles-file/*/office:automatic-styles/style:page-layout[1]/style:page-layout-properties"/>
 
192
 
 
193
                <xsl:variable name="printOrientation"  select="$pageProperties/@style:print-orientation" />
 
194
                <xsl:variable name="pageWidth"         select="$pageProperties/@fo:page-width" />
 
195
                <xsl:variable name="pageHeight"        select="$pageProperties/@fo:page-height" />
 
196
                <xsl:choose>
 
197
                        <xsl:when test="$pageWidth and $pageHeight">
 
198
                                <xsl:text>size: </xsl:text>
 
199
                                <xsl:value-of select="$pageWidth" />
 
200
                                <xsl:text> </xsl:text>
 
201
                                <xsl:value-of select="$pageHeight" />
 
202
                                <xsl:text>; </xsl:text>
 
203
                        </xsl:when>
 
204
                        <xsl:when test="$printOrientation">
 
205
                                <xsl:text>size: </xsl:text>
 
206
                                <xsl:value-of select="$printOrientation" />
 
207
                                <xsl:text>; </xsl:text>
 
208
                        </xsl:when>
 
209
                </xsl:choose>
 
210
        </xsl:template>
 
211
 
 
212
 
 
213
 
 
214
        <xsl:template name="page-margin">
 
215
                <xsl:param name="globalData" />
 
216
 
 
217
                <!-- approximation as attribute belongs to a page style, which won't work in XHTML -->
 
218
                <xsl:variable name="pageProperties" select="$globalData/styles-file/*/office:automatic-styles/style:page-layout[1]/style:page-layout-properties"/>
 
219
 
 
220
                <xsl:variable name="marginTop"  select="$pageProperties/@fo:margin-top" />
 
221
                <xsl:if test="$marginTop">
 
222
                        <xsl:text>margin-top: </xsl:text>
 
223
                        <xsl:value-of select="$marginTop" />
 
224
                        <xsl:text>; </xsl:text>
 
225
                </xsl:if>
 
226
                <xsl:variable name="marginBottom"  select="$pageProperties/@fo:margin-bottom" />
 
227
                <xsl:if test="$marginBottom">
 
228
                        <xsl:text>margin-bottom: </xsl:text>
 
229
                        <xsl:value-of select="$marginBottom" />
 
230
                        <xsl:text>; </xsl:text>
 
231
                </xsl:if>
 
232
                <xsl:variable name="marginLeft"  select="$pageProperties/@fo:margin-left" />
 
233
                <xsl:if test="$marginLeft">
 
234
                        <xsl:text>margin-left: </xsl:text>
 
235
                        <xsl:value-of select="$marginLeft" />
 
236
                        <xsl:text>; </xsl:text>
 
237
                </xsl:if>
 
238
                <xsl:variable name="marginRight"  select="$pageProperties/@fo:margin-right" />
 
239
                <xsl:if test="$marginRight">
 
240
                        <xsl:text>margin-right: </xsl:text>
 
241
                        <xsl:value-of select="$marginRight" />
 
242
                </xsl:if>
 
243
        </xsl:template>
 
244
 
 
245
 
 
246
        <!-- *************************** -->
 
247
        <!-- *** Common XHTML header *** -->
 
248
        <!-- *************************** -->
 
249
 
 
250
        <xsl:template name='xhtml-header-properties'>
 
251
                <xsl:param name="globalData" />
 
252
 
 
253
                <xsl:variable name="netloc">
 
254
                <xsl:for-each select="$globalData/meta-file/*/office:meta/meta:user-defined">
 
255
                <xsl:if test="./@meta:name='ODF.base'">
 
256
                <xsl:value-of select="." />
 
257
                </xsl:if>
 
258
                </xsl:for-each>
 
259
                <xsl:for-each select="$globalData/meta-file/*/office:meta/meta:user-defined">
 
260
                <xsl:if test="./@meta:name='ODF.filename'">
 
261
                <xsl:value-of select="." />
 
262
                </xsl:if>
 
263
                </xsl:for-each>
 
264
                </xsl:variable>
 
265
 
 
266
                <xsl:variable name="lang">
 
267
                         <xsl:choose>
 
268
                                 <xsl:when test="$globalData/meta-file/*/office:meta/dc:language">
 
269
                                         <xsl:value-of select="$globalData/meta-file/*/office:meta/dc:language" />
 
270
                                 </xsl:when>
 
271
                                 <xsl:otherwise>en-US</xsl:otherwise>
 
272
                         </xsl:choose>
 
273
                </xsl:variable>
 
274
 
 
275
                <xsl:variable name="prov">
 
276
                         <xsl:choose>
 
277
                                 <xsl:when test="$globalData/meta-file/*/office:meta/meta:printed-by">
 
278
                                         <xsl:value-of select="concat('Printed by &quot;',$globalData/meta-file/*/office:meta/meta:printed-by,'&quot;[dc:publisher] on &quot;',$globalData/meta-file/*/office:meta/meta:print-date,'&quot;[dc:date] in &quot;',$lang,'&quot;[dc:language]')" />
 
279
                                 </xsl:when>
 
280
                                 <xsl:otherwise />
 
281
                         </xsl:choose>
 
282
                </xsl:variable>
 
283
 
 
284
                <xsl:variable name="keywords">
 
285
                        <xsl:for-each select="$globalData/meta-file/*/office:meta/meta:keyword">
 
286
                                <xsl:value-of select="." />
 
287
                                        <xsl:if test="position() != last()">
 
288
                                                <xsl:text>, </xsl:text>
 
289
                                        </xsl:if>
 
290
                        </xsl:for-each>
 
291
                </xsl:variable>
 
292
 
 
293
                <!-- explicit output content-type for low-tech browser (e.g. IE6) -->
 
294
                <xsl:element name="meta">
 
295
                        <xsl:attribute name="http-equiv">Content-Type</xsl:attribute>
 
296
                        <xsl:attribute name="content">text/html; charset=utf-8</xsl:attribute>
 
297
                </xsl:element>
 
298
 
 
299
                <!-- title of document for browser frame title -->
 
300
                <xsl:element name="title">
 
301
                <xsl:attribute name="lang" namespace="http://www.w3.org/XML/1998/namespace">
 
302
                        <xsl:value-of select="$lang" />
 
303
                </xsl:attribute>
 
304
 
 
305
                        <xsl:choose>
 
306
                                <xsl:when test="$globalData/meta-file/*/office:meta/dc:title">
 
307
                                        <xsl:value-of select="$globalData/meta-file/*/office:meta/dc:title" />
 
308
                                </xsl:when>
 
309
                                <!-- providing the mandatory title is a workaround for an IE bug-->
 
310
                                <xsl:otherwise>
 
311
                                        <xsl:text>- no title specified</xsl:text>
 
312
                                </xsl:otherwise>
 
313
                        </xsl:choose>
 
314
                </xsl:element>
 
315
 
 
316
                <!-- title, in DC syntax -->
 
317
                <xsl:element name="meta">
 
318
                        <xsl:attribute name="name">DCTERMS.title</xsl:attribute>
 
319
                        <xsl:attribute name="content">
 
320
                           <xsl:value-of select="$globalData/meta-file/*/office:meta/dc:title" />
 
321
                        </xsl:attribute>
 
322
                        <xsl:attribute name="lang" namespace="http://www.w3.org/XML/1998/namespace">
 
323
                           <xsl:value-of select="$lang" />
 
324
                        </xsl:attribute>
 
325
                </xsl:element>
 
326
 
 
327
                <!-- the identifier for source  (identifier) -->
 
328
                <xsl:call-template name="add-meta-tag">
 
329
                        <xsl:with-param name="meta-name" select="'DCTERMS.identifier'" />
 
330
                        <xsl:with-param name="meta-data" select="translate($netloc, ' ','')" />
 
331
                        <xsl:with-param name="meta-enc" select="'DCTERMS.URI'" />
 
332
                </xsl:call-template>
 
333
 
 
334
                <!-- the language for source  (language) -->
 
335
                <xsl:call-template name="add-meta-tag">
 
336
                        <xsl:with-param name="meta-name" select="'DCTERMS.language'" />
 
337
                        <xsl:with-param name="meta-data" select="$lang" />
 
338
                        <xsl:with-param name="meta-enc" select="'DCTERMS.RFC4646'" />
 
339
                </xsl:call-template>
 
340
 
 
341
                <!-- a bit commercial (generator) -->
 
342
                <xsl:element name="meta">
 
343
                        <xsl:attribute name="name">DCTERMS.source</xsl:attribute>
 
344
                        <xsl:attribute name="content">http://xml.openoffice.org/odf2xhtml</xsl:attribute>
 
345
                </xsl:element>
 
346
 
 
347
                <!-- the author of the input source (author) -->
 
348
                <xsl:call-template name="add-meta-tag">
 
349
                        <xsl:with-param name="meta-name" select="'DCTERMS.creator'" />
 
350
                        <xsl:with-param name="meta-data" select="$globalData/meta-file/*/office:meta/meta:initial-creator" />
 
351
                </xsl:call-template>
 
352
 
 
353
                <!-- creation-date of the input source (issued) -->
 
354
                <xsl:call-template name="add-meta-tag">
 
355
                        <xsl:with-param name="meta-name" select="'DCTERMS.issued'" />
 
356
                        <xsl:with-param name="meta-data" select="$globalData/meta-file/*/office:meta/meta:creation-date" />
 
357
                        <xsl:with-param name="meta-enc" select="'DCTERMS.W3CDTF'" />
 
358
                </xsl:call-template>
 
359
 
 
360
                <!-- name of last changing person of the input source (changedby) -->
 
361
                <xsl:call-template name="add-meta-tag">
 
362
                        <xsl:with-param name="meta-name" select="'DCTERMS.contributor'" />
 
363
                        <xsl:with-param name="meta-data" select="$globalData/meta-file/*/office:meta/dc:creator" />
 
364
                </xsl:call-template>
 
365
 
 
366
                <!-- last changing date of the input source (changed) -->
 
367
                <xsl:call-template name="add-meta-tag">
 
368
                        <xsl:with-param name="meta-name" select="'DCTERMS.modified'" />
 
369
                        <xsl:with-param name="meta-data" select="$globalData/meta-file/*/office:meta/dc:date" />
 
370
                        <xsl:with-param name="meta-enc" select="'DCTERMS.W3CDTF'" />
 
371
                </xsl:call-template>
 
372
 
 
373
                <!-- Last print, as provenance -->
 
374
                <xsl:if test="$prov">
 
375
                <xsl:call-template name="add-meta-tag">
 
376
                        <xsl:with-param name="meta-name" select="'DCTERMS.provenance'" />
 
377
                        <xsl:with-param name="meta-data" select="$prov" />
 
378
                        <xsl:with-param name="meta-lang" select="$lang" />
 
379
                </xsl:call-template>
 
380
                </xsl:if>
 
381
 
 
382
                <!-- keywords about the input source (keywords) -->
 
383
                <xsl:call-template name="add-meta-tag">
 
384
                        <xsl:with-param name="meta-name" select="'DCTERMS.subject'" />
 
385
                        <xsl:with-param name="meta-data" select="normalize-space(concat($globalData/meta-file/*/office:meta/dc:subject,',   ',$keywords))" />
 
386
                        <xsl:with-param name="meta-lang" select="$lang" />
 
387
                </xsl:call-template>
 
388
 
 
389
                <!-- detailed description about the input source (description) -->
 
390
                <xsl:call-template name="add-meta-tag">
 
391
                        <xsl:with-param name="meta-name" select="'DCTERMS.description'" />
 
392
                        <xsl:with-param name="meta-data" select="$globalData/meta-file/*/office:meta/dc:description" />
 
393
                        <xsl:with-param name="meta-lang" select="$lang" />
 
394
                </xsl:call-template>
 
395
 
 
396
 
 
397
                <!-- user defined use of DCTERM tags -->
 
398
                <xsl:for-each select="$globalData/meta-file/*/office:meta/meta:user-defined[starts-with(@meta:name,'DCTERMS.')][not(.='')]">
 
399
                <xsl:call-template name="add-meta-tag">
 
400
                        <xsl:with-param name="meta-name" select="@meta:name" />
 
401
                        <xsl:with-param name="meta-data" select="." />
 
402
                        <!-- <xsl:with-param name="meta-lang" select="$lang" /> -->
 
403
                </xsl:call-template>
 
404
                </xsl:for-each>
 
405
                <!-- user defined use of DC tags (legacy) -->
 
406
                <xsl:for-each select="$globalData/meta-file/*/office:meta/meta:user-defined[starts-with(@meta:name,'DC.')][not(.='')]">
 
407
                <xsl:call-template name="add-meta-tag">
 
408
                        <xsl:with-param name="meta-name" select="@meta:name" />
 
409
                        <xsl:with-param name="meta-data" select="." />
 
410
                        <!-- <xsl:with-param name="meta-lang" select="$lang" /> -->
 
411
                </xsl:call-template>
 
412
                </xsl:for-each>
 
413
 
 
414
                <link rel="schema.DC" href="http://purl.org/dc/elements/1.1/" hreflang="en" />
 
415
                <link rel="schema.DCTERMS" href="http://purl.org/dc/terms/" hreflang="en" />
 
416
                <link rel="schema.DCTYPE" href="http://purl.org/dc/dcmitype/" hreflang="en" />
 
417
                <link rel="schema.DCAM" href="http://purl.org/dc/dcam/" hreflang="en" />
 
418
                <!-- W3C GRDDL Profile -->
 
419
                <!--
 
420
                <link rel="transformation" href="http://xml.openoffice.org/odf2xhtml/rdf-extract.xsl" />
 
421
                -->
 
422
 
 
423
                <!-- base URL of document for resolving relative links  -->
 
424
                <xsl:element name="base">
 
425
                        <xsl:attribute name="href">
 
426
                                <!-- earlier 'targetURL' was used for an absoulte reference of base provided by the Office (file URL)
 
427
                                        <xsl:value-of select="$targetURL" />
 
428
                                        now '.' let relative links work, even if document has been moved -->
 
429
                                <xsl:text>.</xsl:text>
 
430
                        </xsl:attribute>
 
431
                </xsl:element>
 
432
        </xsl:template>
 
433
 
 
434
        <!-- generic template for adding common meta tags -->
 
435
        <xsl:template name="add-meta-tag">
 
436
                <xsl:param name="meta-name" />
 
437
                <xsl:param name="meta-data" />
 
438
                <xsl:param name="meta-enc" />
 
439
                <xsl:param name="meta-lang" />
 
440
 
 
441
                <xsl:if test="$meta-data">
 
442
                        <xsl:element name="meta">
 
443
                                <xsl:attribute name="name">
 
444
                                        <xsl:value-of select="$meta-name" />
 
445
                                </xsl:attribute>
 
446
                                <xsl:attribute name="content">
 
447
                                        <xsl:value-of select="$meta-data" />
 
448
                                </xsl:attribute>
 
449
                                <xsl:if test="$meta-enc">
 
450
                                <xsl:attribute name="scheme">
 
451
                                        <xsl:value-of select="$meta-enc" />
 
452
                                </xsl:attribute>
 
453
                                </xsl:if>
 
454
                                <xsl:if test="$meta-lang">
 
455
                                <xsl:attribute name="lang" namespace="http://www.w3.org/XML/1998/namespace">
 
456
                                        <xsl:value-of select="$meta-lang" />
 
457
                                </xsl:attribute>
 
458
                                </xsl:if>
 
459
                        </xsl:element>
 
460
                </xsl:if>
 
461
        </xsl:template>
 
462
 
 
463
</xsl:stylesheet>