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: body.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" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:chart="urn:oasis:names:tc:opendocument:xmlns:chart:1.0" xmlns:config="urn:oasis:names:tc:opendocument:xmlns:config:1.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:dom="http://www.w3.org/2001/xml-events" xmlns:dr3d="urn:oasis:names:tc:opendocument:xmlns:dr3d:1.0" xmlns:draw="urn:oasis:names:tc:opendocument:xmlns:drawing:1.0" xmlns:fo="urn:oasis:names:tc:opendocument:xmlns:xsl-fo-compatible:1.0" xmlns:form="urn:oasis:names:tc:opendocument:xmlns:form:1.0" xmlns:math="http://www.w3.org/1998/Math/MathML" xmlns:meta="urn:oasis:names:tc:opendocument:xmlns:meta:1.0" xmlns:number="urn:oasis:names:tc:opendocument:xmlns:datastyle:1.0" xmlns:office="urn:oasis:names:tc:opendocument:xmlns:office:1.0" xmlns:ooo="http://openoffice.org/2004/office" xmlns:oooc="http://openoffice.org/2004/calc" xmlns:ooow="http://openoffice.org/2004/writer" xmlns:script="urn:oasis:names:tc:opendocument:xmlns:script:1.0" xmlns:style="urn:oasis:names:tc:opendocument:xmlns:style:1.0" xmlns:svg="urn:oasis:names:tc:opendocument:xmlns:svg-compatible:1.0" xmlns:table="urn:oasis:names:tc:opendocument:xmlns:table:1.0" xmlns:text="urn:oasis:names:tc:opendocument:xmlns:text:1.0" xmlns:xforms="http://www.w3.org/2002/xforms" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 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" xmlns="http://www.w3.org/1999/xhtml">
39
<!--+++++ INCLUDED XSL MODULES +++++-->
41
<!-- helper collection, to convert measures (e.g. inch to pixel using DPI (dots per inch) parameter)-->
42
<xsl:import href="../../common/measure_conversion.xsl"/>
44
<!-- common office body element handling -->
45
<xsl:import href="../common/body.xsl"/>
47
<!-- common table handling -->
48
<xsl:import href="../common/table/table.xsl"/>
50
<!-- xhtml table handling -->
51
<xsl:include href="table.xsl"/>
53
<!-- Useful in case of 'style:map', conditional formatting, where a style references to another -->
54
<xsl:key name="styles" match="/*/office:styles/style:style | /*/office:automatic-styles/style:style" use="@style:name"/>
61
<xsl:template name="create-body">
62
<xsl:param name="globalData"/>
64
<!-- approximation as attribute belongs to a page style, which won't work in XHTML -->
65
<xsl:variable name="pageProperties" select="$globalData/styles-file/*/office:automatic-styles/style:page-layout[1]/style:page-layout-properties"/>
67
<xsl:element name="body">
68
<!-- direction of text flow -->
69
<xsl:variable name="writingMode" select="$pageProperties/@style:writing-mode"/>
70
<xsl:if test="$writingMode">
72
<xsl:when test="contains($writingMode, 'lr')">
73
<xsl:attribute name="dir">ltr</xsl:attribute>
75
<xsl:when test="contains($writingMode, 'rl')">
76
<xsl:attribute name="dir">rtl</xsl:attribute>
81
<!-- adapt page size -->
82
<xsl:variable name="pageWidth" select="$pageProperties/@fo:page-width"/>
84
<!-- multiple backgroundimages for different page styles (never used in html) -->
85
<xsl:variable name="backgroundImage" select="$pageProperties/style:background-image"/>
87
<!-- page margins & background image -->
88
<xsl:if test="$pageWidth or $pageProperties/@fo:* or $backgroundImage/@xlink:href">
89
<xsl:attribute name="style">
90
<xsl:if test="$pageWidth">
91
<xsl:text>max-width:</xsl:text><xsl:value-of select="$pageWidth"/><xsl:text>;</xsl:text>
93
<xsl:if test="$pageProperties/@fo:* or $backgroundImage/@xlink:href">
94
<xsl:apply-templates select="$pageProperties/@fo:*"/>
95
<xsl:if test="$backgroundImage/@xlink:href">
96
<xsl:text>background-image:url(</xsl:text>
97
<xsl:call-template name="create-href">
98
<xsl:with-param name="href" select="$backgroundImage/@xlink:href"/>
100
<xsl:text>);</xsl:text>
102
<xsl:if test="$backgroundImage/@style:repeat">
104
<xsl:when test="$backgroundImage/@style:repeat = 'no-repeat'">
105
<xsl:text>background-repeat:no-repeat;</xsl:text>
108
<xsl:text>background-repeat:repeat;</xsl:text>
112
<xsl:if test="$backgroundImage/@style:position">
113
<xsl:text>background-position:</xsl:text>
114
<xsl:value-of select="$backgroundImage/@style:position"/>
115
<xsl:text>;</xsl:text>
121
<!-- processing the content of the xml file -->
122
<xsl:apply-templates select="/*/office:body/*">
123
<xsl:with-param name="globalData" select="$globalData"/>
124
</xsl:apply-templates>
129
<xsl:template match="office:body/*">
130
<xsl:param name="globalData"/>
132
<!-- not using of 'apply-styles-and-content' as the content table information migth have been added to 'globalData' variable -->
133
<xsl:apply-templates select="@text:style-name | @draw:style-name | @draw:text-style-name | @table:style-name"><!-- | @presentation:style-name -->
134
<xsl:with-param name="globalData" select="$globalData"/>
135
</xsl:apply-templates>
137
<xsl:apply-templates>
138
<xsl:with-param name="globalData" select="$globalData"/>
139
</xsl:apply-templates>
141
<!-- writing the footer- and endnotes beyond the body -->
142
<xsl:call-template name="write-text-nodes">
143
<xsl:with-param name="globalData" select="$globalData"/>
148
<!-- ******************************* -->
149
<!-- *** User Field Declarations *** -->
150
<!-- ******************************* -->
152
<xsl:template match="text:user-field-get | text:user-field-input">
153
<xsl:param name="globalData"/>
155
<xsl:value-of select="."/>
158
<xsl:template match="text:conditional-text">
159
<xsl:param name="globalData"/>
161
<xsl:value-of select="."/>
164
<!-- ODF text fields -->
165
<xsl:template match="text:author-initials |
168
text:character-count |
174
text:editing-cycles |
175
text:editing-duration |
178
text:initial-creator |
180
text:modification-date |
181
text:modification-time |
183
text:page-continuation |
186
text:paragraph-count |
191
text:sender-company |
192
text:sender-country |
195
text:sender-firstname |
196
text:sender-initials |
197
text:sender-lastname |
198
text:sender-phone-private |
199
text:sender-phone-work |
200
text:sender-position |
201
text:sender-postal-code |
202
text:sender-state-or-province |
212
<xsl:param name="globalData"/>
214
<xsl:element name="span">
215
<xsl:attribute name="title"><xsl:value-of select="local-name()"/></xsl:attribute>
216
<xsl:apply-templates>
217
<xsl:with-param name="globalData" select="$globalData"/>
218
</xsl:apply-templates>
224
<!-- *************** -->
225
<!-- *** Textbox *** -->
226
<!-- *************** -->
228
<xsl:template match="draw:text-box">
229
<xsl:param name="globalData"/>
231
<xsl:element name="div">
232
<xsl:if test="@svg:height | @svg:width">
233
<xsl:attribute name="style">
235
<xsl:when test="not(@svg:width)">
236
<xsl:call-template name="svg:height"/>
238
<xsl:when test="not(@svg:height)">
239
<xsl:call-template name="svg:width"/>
242
<xsl:call-template name="svg:height"/>
243
<xsl:call-template name="svg:width"/>
248
<xsl:apply-templates select="@draw:name">
249
<xsl:with-param name="globalData" select="$globalData"/>
250
</xsl:apply-templates>
252
<xsl:call-template name="apply-styles-and-content">
253
<xsl:with-param name="globalData" select="$globalData"/>
258
<!-- inline style helper for the 'div' boxes -->
259
<xsl:template name="svg:height">
260
<xsl:text>height: </xsl:text>
262
<!-- changing the distance measure: inch to in -->
263
<xsl:when test="contains(@svg:height, 'inch')">
264
<xsl:value-of select="substring-before(@svg:height, 'ch')"/>
267
<xsl:value-of select="@svg:height"/>
270
<xsl:text>;</xsl:text>
273
<!-- inline style helper for the 'div' boxes -->
274
<xsl:template name="svg:width">
275
<xsl:text>width: </xsl:text>
277
<!-- changing the distance measure: inch to in -->
278
<xsl:when test="contains(@svg:width, 'inch')">
279
<xsl:value-of select="substring-before(@svg:width, 'ch')"/>
282
<xsl:value-of select="@svg:width"/>
285
<xsl:text>;</xsl:text>
290
<!-- ****************** -->
291
<!-- *** Paragraphs *** -->
292
<!-- ****************** -->
294
<xsl:template match="text:p | draw:page">
295
<xsl:param name="globalData"/>
296
<!-- the footnote symbol is the prefix for a footnote in the footer -->
297
<xsl:param name="footnotePrefix"/>
299
<!-- 1) A draw:text-box my include paragraphs (text:p) itself and in HTML a 'p' can only have inline documents (no other 'p' as children'),
300
a 'div' will be given out instead.
301
2) A images are embedded in a paragraph, but are in CSS not able to express a horizontal alignment for themself (text:align is only valid for block elements).
302
A surrounding 'div' element taking over the image style solves that problem, but is invalid as child of a paragraph
305
<xsl:when test="draw:frame">
306
<xsl:element name="div">
307
<xsl:call-template name="apply-styles-and-content">
308
<xsl:with-param name="globalData" select="$globalData" />
309
<xsl:with-param name="footnotePrefix" select="$footnotePrefix" />
314
<xsl:element name="p">
316
<!-- in ODF borders of paragraphs will be merged by default. Merging means the adjactend paragraphs are building a unit,
317
where only the first and the last will have have a border to the surrounding (top / bottom border)
318
<xsl:variable name="precedingParagraphStyle" select="preceding-sibling::*[1][name() = 'text:p']/@text:style-name"/>
319
<xsl:variable name="followingParagraphStyle" select="following-sibling::*[1][name() = 'text:p']/@text:style-name"/>
321
<xsl:when test="$globalData/all-styles/style[@style:name = current()/@text:style-name]/@mergedBorders">
322
<xsl:variable name="precedingParagraphStyle" select="preceding-sibling::*[1][name() = 'text:p']/@text:style-name"/>
323
<xsl:variable name="followingParagraphStyle" select="following-sibling::*[1][name() = 'text:p']/@text:style-name"/>
325
<xsl:when test="$precedingParagraphStyle or $followingParagraphStyle">
326
<xsl:variable name="isPrecedingBorderParagraph" select="$globalData/all-styles/style[@style:name = $precedingParagraphStyle]/@mergedBorders"/>
327
<xsl:variable name="isFollowingBorderParagraph" select="$globalData/all-styles/style[@style:name = $followingParagraphStyle]/@mergedBorders"/>
329
<xsl:when test="not($isPrecedingBorderParagraph) and $isFollowingBorderParagraph">
330
<xsl:attribute name="class">
331
<xsl:value-of select="concat(translate(@text:style-name, '.,;: %()[]/\+', '_____________'), '_borderStart')"/>
333
<xsl:apply-templates>
334
<xsl:with-param name="globalData" select="$globalData"/>
335
</xsl:apply-templates>
337
<xsl:when test="$isPrecedingBorderParagraph and not($isFollowingBorderParagraph)">
338
<xsl:attribute name="class">
339
<xsl:value-of select="concat(translate(@text:style-name, '.,;: %()[]/\+', '_____________'), '_borderEnd')"/>
341
<xsl:apply-templates>
342
<xsl:with-param name="globalData" select="$globalData"/>
343
</xsl:apply-templates>
346
<xsl:attribute name="class">
347
<xsl:value-of select="translate(@text:style-name, '.,;: %()[]/\+', '_____________')"/>
349
<xsl:apply-templates>
350
<xsl:with-param name="globalData" select="$globalData"/>
351
</xsl:apply-templates>
356
<xsl:call-template name="write-paragraph">
357
<xsl:with-param name="globalData" select="$globalData"/>
363
<xsl:call-template name="write-paragraph">
364
<xsl:with-param name="globalData" select="$globalData" />
365
<xsl:with-param name="footnotePrefix" select="$footnotePrefix" />
374
<xsl:template name="write-paragraph">
375
<xsl:param name="globalData"/>
376
<!-- the footnote symbol is the prefix for a footnote in the footer -->
377
<xsl:param name="footnotePrefix" />
379
<!-- empty paragraph tags does not provoke an carridge return,
380
therefore an non breakable space ( ) have been inserted.-->
382
<xsl:when test="node()">
383
<xsl:call-template name="apply-styles-and-content">
384
<xsl:with-param name="globalData" select="$globalData" />
385
<xsl:with-param name="footnotePrefix" select="$footnotePrefix" />
389
<xsl:call-template name="apply-styles-and-content">
390
<xsl:with-param name="globalData" select="$globalData" />
391
<xsl:with-param name="footnotePrefix" select="$footnotePrefix" />
393
<xsl:text> </xsl:text>
398
<xsl:template match="draw:frame">
399
<xsl:param name="globalData"/>
401
<xsl:element name="div">
402
<xsl:if test="@svg:height | @svg:width">
403
<xsl:attribute name="style">
405
<xsl:when test="not(@svg:width)">
406
<xsl:call-template name="svg:height"/>
408
<xsl:when test="not(@svg:height)">
409
<xsl:call-template name="svg:width"/>
412
<xsl:call-template name="svg:height"/>
413
<xsl:call-template name="svg:width"/>
418
<xsl:apply-templates select="@draw:name">
419
<xsl:with-param name="globalData" select="$globalData"/>
420
</xsl:apply-templates>
422
<xsl:call-template name="apply-styles-and-content">
423
<xsl:with-param name="globalData" select="$globalData"/>
428
<!-- ***************** -->
429
<!-- *** Text Span *** -->
430
<!-- ***************** -->
432
<xsl:template match="text:span">
433
<xsl:param name="globalData"/>
435
<xsl:element name="span">
436
<xsl:call-template name="apply-styles-and-content">
437
<xsl:with-param name="globalData" select="$globalData"/>
444
<!-- **************** -->
445
<!-- *** Headings *** -->
446
<!-- **************** -->
448
<xsl:template match="text:h">
449
<xsl:param name="globalData"/>
451
<!-- no creation of empty headings (without text content) -->
452
<xsl:if test="text()">
453
<!-- The URL linking of an table-of-content is due to a bug (cp. bug id# 102311) not mapped as URL in the XML.
454
Linking of the table-of-content can therefore only be archieved by a work-around in HTML -->
455
<xsl:call-template name="create-heading">
456
<xsl:with-param name="globalData" select="$globalData"/>
461
<!-- default matching for header elements -->
462
<xsl:template name="create-heading">
463
<xsl:param name="globalData"/>
465
<xsl:variable name="headingNumber1">
467
<xsl:when test="@text:outline-level < 6">
468
<xsl:value-of select="@text:outline-level"/>
470
<xsl:otherwise>6</xsl:otherwise>
473
<xsl:variable name="headertyp" select="concat('h', $headingNumber1)"/>
474
<xsl:element name="{$headertyp}">
475
<!-- outline style 'text:min-label-width' is interpreted as a CSS 'margin-right' attribute
476
NOTE: Should be handled as CSS style in style header -->
477
<xsl:variable name="min-label" select="$globalData/office:styles/text:outline-style/text:outline-level-style[@text:level = current()/@text:outline-level]/*/@text:min-label-width"/>
478
<xsl:attribute name="class">
479
<xsl:value-of select="translate(@text:style-name, '.,;: %()[]/\+', '_____________')"/>
483
<!-- writing out a heading number if desired.-->
484
<!-- if a corresponding 'text:outline-style' exist or is not empty -->
486
<xsl:when test="$globalData/office:styles/text:outline-style/text:outline-level-style[@text:level = current()/@text:outline-level]/@style:num-format != ''">
488
<!-- Every heading element will get an unique anchor for its file, from its hiearchy level and name:
489
For example: The heading title 'My favorite heading' might get <a name="1_2_2_My_favorite_heading" /> -->
490
<!-- creating an anchor for referencing the heading (e.g. from content table) -->
491
<xsl:variable name="headingNumber">
492
<!-- write number prefix -->
493
<xsl:value-of select="$globalData/office:styles/text:outline-style/text:outline-level-style[@text:level = current()/@text:outline-level]/@style:num-prefix"/>
494
<xsl:call-template name="write-heading-number">
495
<xsl:with-param name="globalData" select="$globalData"/>
497
<!-- write number suffix -->
498
<xsl:value-of select="$globalData/office:styles/text:outline-style/text:outline-level-style[@text:level = current()/@text:outline-level]/@style:num-suffix"/>
500
<xsl:call-template name="create-heading-anchor">
501
<xsl:with-param name="globalData" select="$globalData"/>
502
<xsl:with-param name="headingNumber" select="$headingNumber"/>
506
<xsl:call-template name="create-heading-anchor">
507
<xsl:with-param name="globalData" select="$globalData"/>
512
<xsl:apply-templates>
513
<xsl:with-param name="globalData" select="$globalData"/>
514
</xsl:apply-templates>
520
<!-- creating an anchor for referencing the heading -->
521
<xsl:template name="create-heading-anchor">
522
<xsl:param name="globalData"/>
523
<xsl:param name="headingNumber" />
525
<xsl:variable name="title">
526
<xsl:apply-templates mode="concatenate"/>
528
<xsl:element namespace="{$namespace}" name="a">
529
<xsl:attribute name="name">
530
<xsl:value-of select="translate(concat($headingNumber, '_', $title), '.,;: %()[]/\+', '_____________')"/>
533
<xsl:element name="span">
534
<!-- outline style 'text:min-label-width' is interpreted as a CSS 'margin-right' attribute
535
NOTE: Should be handled as CSS style in style header -->
536
<xsl:variable name="minLabelDistance" select="$globalData/office:styles/text:outline-style/text:outline-level-style[@text:level = current()/@text:outline-level]/*/@text:min-label-distance"/>
537
<xsl:variable name="minLabelWidth" select="$globalData/office:styles/text:outline-style/text:outline-level-style[@text:level = current()/@text:outline-level]/*/@text:min-label-width"/>
539
<xsl:if test="$minLabelDistance | $minLabelWidth">
540
<xsl:attribute name="style">
541
<xsl:if test="$minLabelDistance">
542
<xsl:text>margin-right:</xsl:text>
543
<xsl:call-template name="convert2cm">
544
<xsl:with-param name="value" select="$minLabelDistance"/>
546
<xsl:text>cm;</xsl:text>
548
<xsl:if test="$minLabelWidth">
549
<xsl:text>min-width:</xsl:text>
550
<xsl:call-template name="convert2cm">
551
<xsl:with-param name="value" select="$minLabelWidth"/>
553
<xsl:text>cm;</xsl:text>
557
<xsl:copy-of select="$headingNumber"/>
562
<xsl:template name="write-heading-number">
563
<xsl:param name="globalData"/>
565
<!-- By default heading start with '1', the parameter 'textStartValue' will only be set, if the attribute @text:start-value exist -->
567
<xsl:when test="$globalData/office:styles/text:outline-style/text:outline-level-style[@text:level = current()/@text:outline-level]/@text:start-value">
568
<xsl:call-template name="calc-heading-number">
569
<xsl:with-param name="globalData" select="$globalData"/>
570
<xsl:with-param name="outlineLevel" select="@text:outline-level"/>
571
<xsl:with-param name="textStartValue" select="$globalData/office:styles/text:outline-style/text:outline-level-style[@text:level = current()/@text:outline-level]/@text:start-value"/>
575
<xsl:call-template name="calc-heading-number">
576
<xsl:with-param name="globalData" select="$globalData"/>
577
<xsl:with-param name="outlineLevel" select="@text:outline-level"/>
584
Find the correct heading no., which is the sum of 'text:start-value'
585
and preceding siblings of 'text:h' with the same 'text:outline-level' (until a text:outline-level with lower value is found).
586
If the 'text:start-value is not set the default value of '1' has to be taken.
587
If a heading number is found (e.g. text:outline-level='3') all heading numbers
588
for the higher levels have to be written out -->
589
<xsl:template name="calc-heading-number">
590
<xsl:param name="globalData"/>
591
<xsl:param name="outlineLevel"/><!-- text level of the heading -->
592
<xsl:param name="iOutlineLevel" select="1"/><!-- iterator, counts from 1 to the text level of the heading -->
593
<xsl:param name="textStartValue" select="1"/><!-- text level to start with, default is '1' -->
596
<!-- iText levels counts up from '1' to outlineLevel
597
Which means writing a heading number from left to right -->
598
<xsl:when test="$iOutlineLevel < $outlineLevel">
600
<!-- Write preceding heading numbers -->
601
<xsl:call-template name="writeNumber">
602
<xsl:with-param name="numberDigit">
603
<xsl:call-template name="calc-heading-digit">
604
<xsl:with-param name="value" select="0"/>
605
<xsl:with-param name="currentoutlineLevel" select="$iOutlineLevel"/>
608
<xsl:with-param name="numberFormat" select="$globalData/office:styles/text:outline-style/text:outline-level-style[@text:level = ($outlineLevel)]/@style:num-format"/>
611
<xsl:when test="$globalData/office:styles/text:outline-style/text:outline-level-style[@text:level = ($iOutlineLevel + 1)]/@text:start-value">
612
<xsl:call-template name="calc-heading-number">
613
<xsl:with-param name="globalData" select="$globalData"/>
614
<xsl:with-param name="outlineLevel" select="$outlineLevel"/>
615
<xsl:with-param name="iOutlineLevel" select="$iOutlineLevel + 1"/>
616
<xsl:with-param name="textStartValue" select="$globalData/office:styles/text:outline-style/text:outline-level-style[@text:level = ($iOutlineLevel + 1)]/@text:start-value"/>
620
<xsl:call-template name="calc-heading-number">
621
<xsl:with-param name="globalData" select="$globalData"/>
622
<xsl:with-param name="outlineLevel" select="$outlineLevel"/>
623
<xsl:with-param name="iOutlineLevel" select="$iOutlineLevel + 1"/>
629
<!-- Write preceding heading numbers -->
630
<xsl:call-template name="writeNumber">
631
<xsl:with-param name="numberDigit">
632
<xsl:call-template name="calc-heading-digit">
633
<xsl:with-param name="value" select="$textStartValue"/>
634
<xsl:with-param name="currentoutlineLevel" select="$iOutlineLevel"/>
636
</xsl:with-param><xsl:with-param name="numberFormat" select="$globalData/office:styles/text:outline-style/text:outline-level-style[@text:level = $outlineLevel]/@style:num-format"/>
637
<xsl:with-param name="last" select="true()"/>
643
<xsl:template name="writeNumber">
644
<xsl:param name="numberDigit"/>
645
<xsl:param name="numberFormat"/>
646
<xsl:param name="last"/>
649
<xsl:when test="not($numberFormat)">
650
<xsl:number value="$numberDigit" format="1."/>
654
<xsl:when test="$last">
655
<xsl:number value="$numberDigit" format="{$numberFormat}"/>
658
<xsl:number value="$numberDigit" format="{$numberFormat}."/>
665
<xsl:template name="calc-heading-digit">
666
<xsl:param name="value"/>
667
<xsl:param name="currentoutlineLevel"/>
668
<xsl:param name="i" select="1"/>
670
<xsl:variable name="precedingoutlineLevel" select="preceding-sibling::text:h[$i]/@text:outline-level"/>
672
<xsl:when test="$currentoutlineLevel = $precedingoutlineLevel">
673
<xsl:call-template name="calc-heading-digit">
674
<xsl:with-param name="value" select="$value + 1"/>
675
<xsl:with-param name="currentoutlineLevel" select="$currentoutlineLevel"/>
676
<xsl:with-param name="i" select="$i + 1"/>
679
<xsl:when test="$currentoutlineLevel < $precedingoutlineLevel">
680
<xsl:call-template name="calc-heading-digit">
681
<xsl:with-param name="value" select="$value"/>
682
<xsl:with-param name="currentoutlineLevel" select="$currentoutlineLevel"/>
683
<xsl:with-param name="i" select="$i + 1"/>
687
<xsl:value-of select="$value"/>
692
<!-- Neglect Annotations -->
693
<xsl:template match="office:annotation" mode="concatenate"/>
695
<!-- Match text:placeholder child nodes (e.g. text) -->
696
<xsl:template match="text:placeholder">
697
<xsl:param name="globalData"/>
699
<xsl:call-template name="apply-styles-and-content">
700
<xsl:with-param name="globalData" select="$globalData"/>
704
<!-- ************* -->
705
<!-- *** Link *** -->
706
<!-- ************* -->
708
<xsl:template match="text:a | draw:a">
709
<xsl:param name="globalData"/>
711
<xsl:call-template name="create-common-anchor-link">
712
<xsl:with-param name="globalData" select="$globalData"/>
717
<xsl:template name="create-common-anchor-link">
718
<xsl:param name="globalData"/>
720
<xsl:element name="a">
721
<xsl:attribute name="href">
722
<xsl:call-template name="create-href">
723
<xsl:with-param name="href" select="@xlink:href"/>
726
<xsl:call-template name="apply-styles-and-content">
727
<xsl:with-param name="globalData" select="$globalData"/>
734
<!-- ******************* -->
735
<!-- *** Image Link *** -->
736
<!-- ******************* -->
738
<!-- currently suggesting that all draw:object-ole elements are images -->
739
<xsl:template match="draw:image | draw:object-ole">
740
<xsl:param name="globalData"/>
743
<xsl:when test="parent::text:p or parent::text:span or parent::text:h or parent::draw:a or parent::text:a or text:ruby-base">
744
<!-- XHTML does not allow the mapped elements to contain paragraphs -->
745
<xsl:call-template name="create-image-element">
746
<xsl:with-param name="globalData" select="$globalData"/>
750
<!-- images are embedded in a paragraph, but are in CSS not able to express a horizontal alignment for themself.
751
A 'div' element taking over the image style would solve that problem, but is invalid as child of a paragraph -->
752
<xsl:element name="p">
753
<xsl:apply-templates select="@draw:style-name">
754
<xsl:with-param name="globalData" select="$globalData"/>
755
</xsl:apply-templates>
757
<xsl:call-template name="create-image-element">
758
<xsl:with-param name="globalData" select="$globalData"/>
765
<xsl:template name="create-image-element">
766
<xsl:param name="globalData"/>
768
<xsl:element name="img">
769
<xsl:if test="../@svg:width">
770
<xsl:attribute name="width">
771
<xsl:call-template name="convert2px">
772
<xsl:with-param name="value" select="../@svg:width"/>
776
<xsl:if test="../@svg:height">
777
<xsl:attribute name="height">
778
<xsl:call-template name="convert2px">
779
<xsl:with-param name="value" select="../@svg:height"/>
783
<xsl:attribute name="alt">
785
<xsl:when test="../svg:desc">
786
<xsl:value-of select="../svg:desc"/>
790
Accessibility Warning:
791
No alternate text ('svg:desc' element) set for
792
image '<xsl:value-of select="@xlink:href"/>'!</xsl:message>
797
<xsl:attribute name="src">
798
<xsl:call-template name="create-href">
799
<xsl:with-param name="href" select="@xlink:href"/>
803
<!-- style interpretation only, as no subelements are allowed for img in XHTML -->
804
<xsl:apply-templates select="@draw:style-name">
805
<xsl:with-param name="globalData" select="$globalData"/>
806
</xsl:apply-templates>
810
<!-- ************ -->
811
<!-- *** list *** -->
812
<!-- ************ -->
814
Due to the requirements below the ODF list functionality is not handled by CSS, but the list labels calculated and written by XSLT.
820
One significant difference between XHTML and Office List elements is that a list without text nodes but only further list children
821
would not show a list symbol in the Office, but in the browser from XHTML.
824
Since OASIS Open Document XML (implemented in OOo2.0) only one parent type exists for list items
825
the 'text:list' element. The XHTML element 'ol', 'ul' will be choosen upon the list style type.
828
An Office list may be spread over the whole document. Linked by their style and text:continue-numbering='true'.
831
An Office list can use characters or images as list label.
834
An Office list can have a prefix and suffix around the list label.
837
An Office list style may have the attribute consecutive numbering, which resolves in a list counting for all levels
840
An Office list may (re)start on any arbitrary value by using @text:start-value on the text:list-item
845
The indent of a list label is not only calculated by using the text:space-before of the list level (listLevelStyle), but
846
as well taking the left margin of the first paragraph (or heading) of the list into account as long it is not negative.
848
| MARGIN LEFT | LABEL |
850
| text:space-before (listlevelstyle) | text:min-label-width |
851
| + fo:left-margin (firstParagraph) | |
853
Further details beyond text:list-list..
855
<xsl:key name="listStyles" match="/*/office:styles/text:list-style | /*/office:automatic-styles/text:list-style |
856
/*/office:styles/style:graphic-properties/text:list-style | /*/office:automatic-styles/style:graphic-properties/text:list-style" use="@style:name"/>
859
A text list may only have text:list-item and text:list-header as children.
861
<xsl:template match="text:list">
862
<xsl:param name="globalData"/>
863
<xsl:param name="isListNumberingReset"/>
864
<xsl:param name="isNextLevelNumberingReset"/>
865
<xsl:param name="listLevel" select="1"/>
866
<xsl:param name="listRestart" select="false()"/>
867
<xsl:param name="itemLabel" select="''"/>
869
<xsl:param name="listStyle"/>
871
<xsl:param name="listStyleName" select="@text:style-name"/>
873
<!-- To choose list type - get the list style, with the same 'text:style-name' and same 'text:level' -->
874
<xsl:variable name="listStyle" select="key('listStyles', $listStyleName)"/>
875
<xsl:variable name="listLevelStyle" select="$listStyle/*[@text:level = number($listLevel)]"/>
876
<xsl:variable name="listIndent">
877
<xsl:call-template name="getListIndent">
878
<xsl:with-param name="globalData" select="$globalData"/>
879
<xsl:with-param name="listLevelStyle" select="$listLevelStyle"/>
880
<xsl:with-param name="firstPara" select="*[1]/*[name() = 'text:p' or name() = 'text:h'][1]"/>
883
<xsl:variable name="isEmptyList" select="not(*[1]/*[name() = 'text:h' or name() = 'text:p'])"/>
884
<xsl:variable name="listType">
886
<!-- ordered list -->
887
<xsl:when test="name($listLevelStyle) = 'text:list-level-style-number'">
888
<xsl:text>ol</xsl:text>
890
<!-- unordered list (bullet or image) -->
892
<xsl:text>ul</xsl:text>
896
<xsl:element name="{$listType}">
897
<xsl:apply-templates select="*[1]" mode="listItemSibling">
898
<xsl:with-param name="globalData" select="$globalData"/>
899
<xsl:with-param name="isEmptyList" select="$isEmptyList"/>
900
<xsl:with-param name="isListNumberingReset" select="$isNextLevelNumberingReset"/>
901
<xsl:with-param name="isNextLevelNumberingReset">
903
<xsl:when test="$isListNumberingReset">
904
<xsl:value-of select="true()"/>
907
<!-- A list is empty if a text:list does not have a text:list-header or text:list-item (wildcard as only those can exist beyond a text:list), which contains a text:h or text:p -->
908
<xsl:value-of select="not($isEmptyList)"/>
912
<xsl:with-param name="itemLabel" select="$itemLabel"/>
913
<xsl:with-param name="listIndent" select="$listIndent"/>
914
<xsl:with-param name="listLevel" select="$listLevel"/>
915
<xsl:with-param name="listLevelStyle" select="$listLevelStyle"/>
916
<xsl:with-param name="listRestart">
918
<xsl:when test="$listRestart">
919
<xsl:value-of select="$listRestart"/>
922
<!-- descdendants restart their list numbering, when an ancestor is not empty -->
923
<xsl:value-of select="not($isEmptyList)"/>
927
<xsl:with-param name="listStyle" select="$listStyle"/>
928
<xsl:with-param name="listStyleName" select="$listStyleName"/>
929
<xsl:with-param name="minLabelDist">
931
<xsl:when test="$listLevelStyle/*/@text:min-label-distance">
932
<xsl:call-template name="convert2cm">
933
<xsl:with-param name="value" select="$listLevelStyle/*/@text:min-label-distance"/>
936
<xsl:otherwise>0</xsl:otherwise>
939
<xsl:with-param name="minLabelWidth">
941
<xsl:when test="$listLevelStyle/*/@text:min-label-width">
942
<xsl:call-template name="convert2cm">
943
<xsl:with-param name="value" select="$listLevelStyle/*/@text:min-label-width"/>
946
<xsl:otherwise>0</xsl:otherwise>
949
</xsl:apply-templates>
953
<!-- See comment before text:list template -->
954
<xsl:template name="getListIndent">
955
<xsl:param name="globalData"/>
956
<xsl:param name="listLevelStyle"/>
957
<!-- The first paragraph of the list item (heading is special paragraph in ODF) -->
958
<xsl:param name="firstPara" />
960
<!-- Styles of first paragraph in list item, including ancestor styles (inheritance) -->
961
<xsl:variable name="firstParaStyles" select="$globalData/all-styles/style[@style:name = $firstPara/@text:style-name]/final-properties"/>
963
<!-- Only the left margin of the first paragraph of a list item will be added to the margin of the complete list (all levels)-->
964
<xsl:variable name="firstParaLeftMargin">
966
<xsl:when test="contains($firstParaStyles, 'margin-left:')">
967
<xsl:call-template name="convert2cm">
968
<xsl:with-param name="value" select="normalize-space(substring-before(substring-after($firstParaStyles, 'margin-left:'), ';'))"/>
971
<xsl:otherwise>0</xsl:otherwise>
974
<xsl:variable name="spaceBefore">
976
<xsl:when test="$listLevelStyle/*/@text:space-before">
977
<xsl:call-template name="convert2cm">
978
<xsl:with-param name="value" select="$listLevelStyle/*/@text:space-before"/>
981
<xsl:otherwise>0</xsl:otherwise>
984
<!-- Only if the left-margin of the first paragraph is positive the sum
985
text:space-before and fo:left-margin is taken as list indent -->
987
<xsl:when test="$firstParaLeftMargin > 0">
988
<xsl:value-of select="$firstParaLeftMargin + $spaceBefore"/>
991
<xsl:value-of select="$spaceBefore"/>
996
<!-- ****************** -->
997
<!-- *** list item *** -->
998
<!-- ****************** -->
1000
Left margin of the complete list:
1001
The space between left page and the list symbol (left-margin) is in the Office implemented by
1002
the sum of three values:
1003
1) 'text:space-before', which is part of the 'text:list-style' element.
1004
2) 'margin:left' from the style of the first child (e.g. paragraph).
1005
3) 'fo:text-indent' the indent of the first line of some child (e.g. paragraph) (applied by CSS class style)
1007
Possible list children:
1008
<!ELEMENT text:list-item (text:p|text:h|text:list|text:list)+>
1010
In the Office the list label before the text depends on two attributes:
1011
- 'text:min-label-width': the distance between list label and all text of the list item.
1012
- 'text:min-label-distance': the distance between list label and text of the first line,
1013
only used, when text does not fit in text:min-label-width (ignored)
1016
<xsl:template match="text:list-item | text:list-header" mode="listItemSibling">
1017
<xsl:param name="globalData"/>
1018
<xsl:param name="firstitemLabelWidth"/>
1019
<xsl:param name="isEmptyList" select="not(*[name() = 'text:h' or name() = 'text:p'])"/>
1020
<xsl:param name="isListNumberingReset"/>
1021
<xsl:param name="isNextLevelNumberingReset"/>
1022
<xsl:param name="itemNumber"/>
1023
<xsl:param name="itemLabel"/>
1024
<xsl:param name="listLevel"/>
1025
<xsl:param name="listLevelStyle"/>
1026
<xsl:param name="listRestart"/>
1027
<xsl:param name="listStyle"/>
1028
<xsl:param name="listStyleName"/>
1029
<xsl:param name="minLabelDist"/>
1030
<xsl:param name="minLabelWidth"/>
1031
<xsl:param name="listIndent" />
1034
<xsl:variable name="listIndentNew">
1036
<xsl:when test="$listIndent">
1037
<xsl:value-of select="$listIndent"/>
1040
<xsl:call-template name="getListIndent">
1041
<xsl:with-param name="globalData" select="$globalData"/>
1042
<xsl:with-param name="listLevelStyle" select="$listLevelStyle"/>
1043
<xsl:with-param name="firstPara" select="*[name() = 'text:p' or name() = 'text:h'][1]" />
1044
</xsl:call-template>
1048
<xsl:variable name="itemNumberNew">
1049
<xsl:if test="$listStyle/text:list-level-style-number">
1051
<xsl:when test="$isEmptyList">
1052
<!-- An empty list item (no text:h/text:p as child), will not count as item and does not increment the count. -->
1053
<xsl:variable name="tempItemNumber">
1055
<!-- siblings will be incremented by one -->
1056
<xsl:when test="$itemNumber">
1057
<xsl:value-of select="$itemNumber + 1"/>
1059
<!-- if a higher list level had content the numbering starts with 1 -->
1060
<xsl:when test="$isListNumberingReset and $listLevel > 1">
1061
<xsl:value-of select="1"/>
1064
<xsl:call-template name="getItemNumber">
1065
<xsl:with-param name="isEmptyList" select="$isEmptyList"/>
1066
<xsl:with-param name="isListNumberingReset" select="$isListNumberingReset"/>
1067
<xsl:with-param name="itemNumber" select="$itemNumber"/>
1068
<xsl:with-param name="listStyleName" select="$listStyleName"/>
1069
<xsl:with-param name="listLevel" select="$listLevel"/>
1070
<xsl:with-param name="listLevelStyle" select="$listLevelStyle"/>
1071
<xsl:with-param name="listStyle" select="$listStyle"/>
1072
</xsl:call-template>
1077
<!-- in case the empty list-item is the first list-item in document -->
1078
<xsl:when test="$tempItemNumber = 1">
1079
<xsl:value-of select="1"/>
1082
<xsl:value-of select="$tempItemNumber - 1"/>
1088
<xsl:when test="@text:start-value">
1089
<xsl:value-of select="@text:start-value"/>
1091
<xsl:when test="$listLevelStyle/@text:start-value">
1092
<xsl:value-of select="$listLevelStyle/@text:start-value"/>
1094
<!-- siblings will be incremented by one -->
1095
<xsl:when test="$itemNumber">
1096
<xsl:value-of select="$itemNumber + 1"/>
1098
<!-- if a higher list level had content the numbering starts with 1 -->
1099
<xsl:when test="$isListNumberingReset and $listLevel > 1">
1100
<xsl:value-of select="1"/>
1103
<xsl:call-template name="getItemNumber">
1104
<xsl:with-param name="isEmptyList" select="$isEmptyList"/>
1105
<xsl:with-param name="isListNumberingReset" select="$isListNumberingReset"/>
1106
<xsl:with-param name="itemNumber" select="$itemNumber"/>
1107
<xsl:with-param name="listStyleName" select="$listStyleName"/>
1108
<xsl:with-param name="listLevel" select="$listLevel"/>
1109
<xsl:with-param name="listLevelStyle" select="$listLevelStyle"/>
1110
<xsl:with-param name="listStyle" select="$listStyle"/>
1111
</xsl:call-template>
1118
<xsl:variable name="itemLabelNew">
1119
<xsl:if test="$listStyle/text:list-level-style-number">
1121
A numbered label (e.g. 2.C.III) is created for every text:list-item/header.
1122
Above list levels are listed in the label, if the list-style requires this. Levels are separated by a '.'
1123
Formatation is dependent for every list level depth.
1124
The label is passed from anchestor text:list-item/header and if requrired truncated.
1125
The prefix/suffix (as well list level dependent) comes before and after the complete label (after truncation)
1127
<!-- Numbered label will be generated -->
1128
<xsl:call-template name="createItemLabel">
1129
<xsl:with-param name="itemNumber" select="$itemNumberNew"/>
1130
<xsl:with-param name="itemLabel" select="$itemLabel"/>
1131
<xsl:with-param name="listLevelsToDisplay">
1132
<xsl:variable name="display" select="$listLevelStyle/@text:display-levels"/>
1134
<xsl:when test="$display">
1135
<xsl:value-of select="$display"/>
1137
<xsl:otherwise>1</xsl:otherwise>
1140
<xsl:with-param name="listLevel" select="$listLevel"/>
1141
<xsl:with-param name="listStyleName" select="$listStyleName"/>
1142
<xsl:with-param name="listLevelStyle" select="$listLevelStyle"/>
1143
<xsl:with-param name="listStyle" select="$listStyle"/>
1144
</xsl:call-template>
1147
<xsl:element name="li">
1149
<xsl:when test="$isEmptyList">
1150
<xsl:apply-templates>
1151
<xsl:with-param name="globalData" select="$globalData"/>
1152
<xsl:with-param name="itemLabel" select="$itemLabelNew"/>
1153
<xsl:with-param name="listLevel" select="$listLevel + 1"/>
1154
<xsl:with-param name="listStyleName" select="$listStyleName"/>
1155
</xsl:apply-templates>
1158
<xsl:variable name="listLabelElement">
1159
<!-- Numbering is being done by this transformation creating a HTML span representing the number label
1160
The html:span represents the list item/header label (e.g. 1.A.III)
1161
As the html:span is usually a inline element is formated by CSS as block element to use width upon it,
1162
to disable the caridge return float:left is used and later neglected -->
1163
<span class="{$listLevelStyle/@text:style-name}" style="display:block;float:left;min-width:{$minLabelWidth}cm;">
1165
<xsl:when test="$listStyle/text:list-level-style-bullet">
1166
<xsl:value-of select="$listLevelStyle/@style:num-prefix"/>
1167
<xsl:value-of select="$listStyle/text:list-level-style-bullet/@text:bullet-char"/>
1168
<xsl:value-of select="$listLevelStyle/@style:num-suffix"/>
1170
<xsl:when test="$listStyle/text:list-level-style-number">
1171
<xsl:value-of select="$listLevelStyle/@style:num-prefix"/>
1172
<xsl:value-of select="$itemLabelNew"/>
1173
<xsl:value-of select="$listLevelStyle/@style:num-suffix"/>
1176
<!-- Listing with image as bullets, taken from the list style's href -->
1177
<xsl:value-of select="$listStyle/text:list-level-style-image/@xlink:href"/>
1182
<!-- Maybe the following children: text:h, text:p, list:text, text:soft-page-break -->
1183
<xsl:apply-templates mode="first-list-child-margin-adaption" select="*[1]">
1184
<xsl:with-param name="globalData" select="$globalData"/>
1185
<xsl:with-param name="isEmptyList" select="$isEmptyList"/>
1186
<xsl:with-param name="isNextLevelNumberingReset" select="$isNextLevelNumberingReset"/>
1187
<!-- The new created label is given to the children -->
1188
<xsl:with-param name="itemLabel" select="$itemLabelNew"/>
1189
<xsl:with-param name="listLabelElement" select="$listLabelElement"/>
1190
<xsl:with-param name="listLevel" select="$listLevel + 1"/>
1191
<xsl:with-param name="listLevelStyle" select="$listLevelStyle"/>
1192
<xsl:with-param name="listRestart" select="$listRestart"/>
1193
<xsl:with-param name="listStyle" select="$listStyle"/>
1194
<xsl:with-param name="listStyleName" select="$listStyleName"/>
1195
<xsl:with-param name="listIndent" select="$listIndentNew"/>
1196
<xsl:with-param name="minLabelWidth" select="$minLabelWidth"/>
1197
</xsl:apply-templates>
1201
<xsl:apply-templates select="following-sibling::*[1]" mode="listItemSibling">
1202
<xsl:with-param name="globalData" select="$globalData"/>
1203
<xsl:with-param name="isListNumberingReset" select="$isListNumberingReset"/>
1204
<xsl:with-param name="isNextLevelNumberingReset" select="$isNextLevelNumberingReset"/>
1205
<xsl:with-param name="itemNumber" select="$itemNumberNew"/>
1206
<xsl:with-param name="listIndent">
1208
<xsl:when test="not($isEmptyList)"><xsl:value-of select="$listIndentNew"/></xsl:when>
1211
<!-- Receives the same parent label -->
1212
<xsl:with-param name="itemLabel" select="$itemLabel"/>
1213
<xsl:with-param name="listLevel" select="$listLevel"/>
1214
<xsl:with-param name="listLevelStyle" select="$listLevelStyle"/>
1215
<xsl:with-param name="listStyle" select="$listStyle"/>
1216
<xsl:with-param name="listStyleName" select="$listStyleName"/>
1217
<xsl:with-param name="minLabelDist" select="$minLabelDist"/>
1218
<xsl:with-param name="minLabelWidth" select="$minLabelWidth"/>
1219
</xsl:apply-templates>
1223
<!-- Each key element holds the set of all text:list-item/text:list-header of a certain level and a certain style -->
1224
<xsl:key name="getListItemsByLevelAndStyle" use="concat(count(ancestor::text:list), ancestor::text:list/@text:style-name)" match="text:list-item | text:list-header"/>
1225
<!-- Each key element holds the set of all text:list-item/text:list-header of a certain style -->
1226
<xsl:key name="getListItemsByStyle" use="ancestor::text:list/@text:style-name" match="text:list-item | text:list-header"/>
1229
<!-- The Numbering start value (or offset from regular counteing) is used at the first item of offset,
1230
but have to be reused on following item/headers with no text:start-value -->
1231
<xsl:template name="getItemNumber">
1232
<xsl:param name="listLevel"/>
1233
<xsl:param name="listLevelStyle"/>
1234
<xsl:param name="listStyleName"/>
1235
<xsl:param name="listStyle"/>
1237
<xsl:call-template name="countListItemTillStartValue">
1238
<xsl:with-param name="listLevel" select="$listLevel"/>
1239
<xsl:with-param name="listLevelStyle" select="$listLevelStyle"/>
1240
<xsl:with-param name="listStyleName" select="$listStyleName"/>
1241
<xsl:with-param name="listStyle" select="$listStyle"/>
1242
<xsl:with-param name="precedingListItemsOfSameLevelAndStyle" select="preceding::text:list-item[generate-id(key('getListItemsByLevelAndStyle', concat($listLevel, $listStyleName))) =
1243
generate-id(key('getListItemsByLevelAndStyle', concat(count(ancestor::text:list), ancestor::text:list/@text:style-name)))]"/>
1244
<xsl:with-param name="precedingListItemsOfSameStyle" select="preceding::text:list-item[generate-id(key('getListItemsByStyle', $listStyleName)) =
1245
generate-id(key('getListItemsByStyle', ancestor::text:list/@text:style-name))]"/>
1246
</xsl:call-template>
1249
<!-- When there is a text:start-value the last have to be found and added to the number -->
1250
<xsl:template name="countListItemTillStartValue">
1251
<xsl:param name="IteratorSameLevelAndStyle" select="1"/>
1252
<xsl:param name="IteratorSameStyle" select="1"/>
1253
<xsl:param name="itemNumber" select="1"/>
1254
<xsl:param name="listLevel"/>
1255
<xsl:param name="listLevelStyle"/>
1256
<xsl:param name="listStyle"/>
1257
<xsl:param name="listStyleName"/>
1258
<xsl:param name="precedingListItemsOfSameLevelAndStyle" />
1259
<xsl:param name="precedingListItemsOfSameLevelAndStyleCount" select="count($precedingListItemsOfSameLevelAndStyle)"/>
1260
<xsl:param name="precedingListItemsOfSameStyle" />
1261
<xsl:param name="precedingListItemsOfSameStyleCount" select="count($precedingListItemsOfSameStyle)"/>
1262
<!-- E.g.: If a list level 2 number is searched, a level 3 with content found with only a level 1 parent with content,
1263
the level 3 gets a 'pseudoLevel' -->
1264
<xsl:param name="pseudoLevel" select="0" />
1266
<!-- set the next of preceding list items. Starting from the current to the next previous text:list-item -->
1267
<xsl:variable name="precedingListItemOfSameLevelAndStyle" select="$precedingListItemsOfSameLevelAndStyle[$precedingListItemsOfSameLevelAndStyleCount - $IteratorSameLevelAndStyle + 1]"/>
1268
<xsl:variable name="precedingListItemOfSameStyle" select="$precedingListItemsOfSameStyle[$precedingListItemsOfSameStyleCount - $IteratorSameStyle + 1]"/>
1270
<xsl:when test="($precedingListItemOfSameStyle and $precedingListItemOfSameLevelAndStyle) or ($precedingListItemOfSameStyle and $listStyle/@text:consecutive-numbering)">
1271
<xsl:for-each select="$precedingListItemOfSameStyle">
1273
<!-- if it is a higher list level element -->
1274
<xsl:when test="$listStyle/@text:consecutive-numbering">
1276
<xsl:call-template name="countListItem">
1277
<xsl:with-param name="IteratorSameLevelAndStyle" select="$IteratorSameLevelAndStyle" />
1278
<xsl:with-param name="IteratorSameStyle" select="$IteratorSameStyle"/>
1279
<xsl:with-param name="itemNumber" select="$itemNumber"/>
1280
<xsl:with-param name="listLevel" select="$listLevel"/>
1281
<xsl:with-param name="listLevelStyle" select="$listLevelStyle"/>
1282
<xsl:with-param name="listStyle" select="$listStyle"/>
1283
<xsl:with-param name="precedingListItemsOfSameLevelAndStyle" select="$precedingListItemsOfSameLevelAndStyle"/>
1284
<xsl:with-param name="precedingListItemsOfSameLevelAndStyleCount" select="$precedingListItemsOfSameLevelAndStyleCount"/>
1285
<xsl:with-param name="precedingListItemsOfSameStyle" select="$precedingListItemsOfSameStyle"/>
1286
<xsl:with-param name="precedingListItemsOfSameStyleCount" select="$precedingListItemsOfSameStyleCount"/>
1287
<xsl:with-param name="pseudoLevel" select="$pseudoLevel" />
1288
</xsl:call-template>
1291
<!-- NOT CONSECUTIVE NUMBERING -->
1292
<xsl:variable name="currentListLevel" select="count(ancestor::text:list)"/>
1294
<!-- IF IT IS A HIGHER LIST LEVEL ELEMENT -->
1295
<xsl:when test="$currentListLevel < $listLevel">
1297
<!-- if it has content the counting is ended -->
1298
<xsl:when test="*[name() = 'text:h' or name() = 'text:p']">
1299
<!-- 2DO: Perhaps the children still have to be processed -->
1300
<xsl:value-of select="$itemNumber + $pseudoLevel"/>
1303
<!-- if it is empty the counting continues -->
1304
<xsl:call-template name="countListItemTillStartValue">
1305
<xsl:with-param name="IteratorSameLevelAndStyle" select="$IteratorSameLevelAndStyle" />
1306
<xsl:with-param name="IteratorSameStyle" select="$IteratorSameStyle + 1"/>
1307
<xsl:with-param name="itemNumber" select="$itemNumber"/>
1308
<xsl:with-param name="listLevel" select="$listLevel"/>
1309
<xsl:with-param name="listLevelStyle" select="$listLevelStyle"/>
1310
<xsl:with-param name="listStyle" select="$listStyle"/>
1311
<xsl:with-param name="precedingListItemsOfSameLevelAndStyle" select="$precedingListItemsOfSameLevelAndStyle"/>
1312
<xsl:with-param name="precedingListItemsOfSameLevelAndStyleCount" select="$precedingListItemsOfSameLevelAndStyleCount"/>
1313
<xsl:with-param name="precedingListItemsOfSameStyle" select="$precedingListItemsOfSameStyle"/>
1314
<xsl:with-param name="precedingListItemsOfSameStyleCount" select="$precedingListItemsOfSameStyleCount"/>
1315
<xsl:with-param name="pseudoLevel" select="$pseudoLevel" />
1316
</xsl:call-template>
1320
<!-- IF IT IS A LIST LEVEL ELEMENT OF THE COUNTING LEVEL -->
1321
<xsl:when test="$currentListLevel = $listLevel">
1322
<xsl:call-template name="countListItem">
1323
<xsl:with-param name="IteratorSameLevelAndStyle" select="$IteratorSameLevelAndStyle" />
1324
<xsl:with-param name="IteratorSameStyle" select="$IteratorSameStyle"/>
1325
<xsl:with-param name="itemNumber" select="$itemNumber"/>
1326
<xsl:with-param name="listLevel" select="$listLevel"/>
1327
<xsl:with-param name="listLevelStyle" select="$listLevelStyle"/>
1328
<xsl:with-param name="listStyle" select="$listStyle"/>
1329
<xsl:with-param name="precedingListItemsOfSameLevelAndStyle" select="$precedingListItemsOfSameLevelAndStyle"/>
1330
<xsl:with-param name="precedingListItemsOfSameLevelAndStyleCount" select="$precedingListItemsOfSameLevelAndStyleCount"/>
1331
<xsl:with-param name="precedingListItemsOfSameStyle" select="$precedingListItemsOfSameStyle"/>
1332
<xsl:with-param name="precedingListItemsOfSameStyleCount" select="$precedingListItemsOfSameStyleCount"/>
1333
<xsl:with-param name="pseudoLevel" select="$pseudoLevel" />
1334
</xsl:call-template>
1337
<!-- list item below the current level does not count -->
1338
<xsl:call-template name="countListItemTillStartValue">
1339
<xsl:with-param name="IteratorSameLevelAndStyle" select="$IteratorSameLevelAndStyle" />
1340
<xsl:with-param name="IteratorSameStyle" select="$IteratorSameStyle + 1"/>
1341
<xsl:with-param name="itemNumber" select="$itemNumber"/>
1342
<xsl:with-param name="listLevel" select="$listLevel"/>
1343
<xsl:with-param name="listLevelStyle" select="$listLevelStyle"/>
1344
<xsl:with-param name="listStyle" select="$listStyle"/>
1345
<xsl:with-param name="listStyleName" select="$listStyleName"/>
1346
<xsl:with-param name="precedingListItemsOfSameLevelAndStyle" select="$precedingListItemsOfSameLevelAndStyle"/>
1347
<xsl:with-param name="precedingListItemsOfSameLevelAndStyleCount" select="$precedingListItemsOfSameLevelAndStyleCount"/>
1348
<xsl:with-param name="precedingListItemsOfSameStyle" select="$precedingListItemsOfSameStyle"/>
1349
<xsl:with-param name="precedingListItemsOfSameStyleCount" select="$precedingListItemsOfSameStyleCount"/>
1350
<xsl:with-param name="pseudoLevel">
1352
<!-- empty list item does not count -->
1353
<xsl:when test="not(*[name() = 'text:h' or name() = 'text:p'])">
1354
<xsl:value-of select="$pseudoLevel"/>
1356
<xsl:otherwise>1</xsl:otherwise>
1359
</xsl:call-template>
1367
<xsl:value-of select="$itemNumber"/>
1372
<xsl:template name="countListItem">
1373
<xsl:param name="IteratorSameLevelAndStyle"/>
1374
<xsl:param name="IteratorSameStyle"/>
1375
<xsl:param name="itemNumber"/>
1376
<xsl:param name="listLevel"/>
1377
<xsl:param name="listLevelStyle"/>
1378
<xsl:param name="listStyle"/>
1379
<xsl:param name="listStyleName"/>
1380
<xsl:param name="precedingListItemsOfSameLevelAndStyle"/>
1381
<xsl:param name="precedingListItemsOfSameLevelAndStyleCount"/>
1382
<xsl:param name="precedingListItemsOfSameStyle"/>
1383
<xsl:param name="precedingListItemsOfSameStyleCount"/>
1384
<xsl:param name="pseudoLevel" />
1387
<xsl:when test="@text:start-value">
1389
<xsl:when test="not(*[name() = 'text:h' or name() = 'text:p'])">
1390
<!-- empty list item does not count -->
1391
<xsl:call-template name="countListItemTillStartValue">
1392
<xsl:with-param name="IteratorSameLevelAndStyle" select="$IteratorSameLevelAndStyle + 1" />
1393
<xsl:with-param name="IteratorSameStyle" select="$IteratorSameStyle + 1"/>
1394
<xsl:with-param name="itemNumber" select="$itemNumber"/>
1395
<xsl:with-param name="listLevel" select="$listLevel"/>
1396
<xsl:with-param name="listLevelStyle" select="$listLevelStyle"/>
1397
<xsl:with-param name="listStyle" select="$listStyle"/>
1398
<xsl:with-param name="precedingListItemsOfSameLevelAndStyle" select="$precedingListItemsOfSameLevelAndStyle"/>
1399
<xsl:with-param name="precedingListItemsOfSameLevelAndStyleCount" select="$precedingListItemsOfSameLevelAndStyleCount"/>
1400
<xsl:with-param name="precedingListItemsOfSameStyle" select="$precedingListItemsOfSameStyle"/>
1401
<xsl:with-param name="precedingListItemsOfSameStyleCount" select="$precedingListItemsOfSameStyleCount"/>
1402
<xsl:with-param name="pseudoLevel" select="$pseudoLevel" />
1403
</xsl:call-template>
1406
<xsl:value-of select="$itemNumber + @text:start-value"/>
1410
<xsl:when test="$listLevelStyle/@text:start-value">
1412
<xsl:when test="not(*[name() = 'text:h' or name() = 'text:p'])">
1413
<!-- empty list item does not count -->
1414
<xsl:call-template name="countListItemTillStartValue">
1415
<xsl:with-param name="IteratorSameLevelAndStyle" select="$IteratorSameLevelAndStyle + 1" />
1416
<xsl:with-param name="IteratorSameStyle" select="$IteratorSameStyle + 1"/>
1417
<xsl:with-param name="itemNumber" select="$itemNumber"/>
1418
<xsl:with-param name="listLevel" select="$listLevel"/>
1419
<xsl:with-param name="listLevelStyle" select="$listLevelStyle"/>
1420
<xsl:with-param name="listStyle" select="$listStyle"/>
1421
<xsl:with-param name="precedingListItemsOfSameLevelAndStyle" select="$precedingListItemsOfSameLevelAndStyle"/>
1422
<xsl:with-param name="precedingListItemsOfSameLevelAndStyleCount" select="$precedingListItemsOfSameLevelAndStyleCount"/>
1423
<xsl:with-param name="precedingListItemsOfSameStyle" select="$precedingListItemsOfSameStyle"/>
1424
<xsl:with-param name="precedingListItemsOfSameStyleCount" select="$precedingListItemsOfSameStyleCount"/>
1425
<xsl:with-param name="pseudoLevel" select="$pseudoLevel" />
1426
</xsl:call-template>
1429
<xsl:value-of select="$itemNumber + $listLevelStyle/@text:start-value"/>
1435
<xsl:when test="not(*[name() = 'text:h' or name() = 'text:p'])">
1436
<!-- empty list item does not count -->
1437
<xsl:call-template name="countListItemTillStartValue">
1438
<xsl:with-param name="IteratorSameLevelAndStyle" select="$IteratorSameLevelAndStyle + 1" />
1439
<xsl:with-param name="IteratorSameStyle" select="$IteratorSameStyle + 1"/>
1440
<xsl:with-param name="itemNumber" select="$itemNumber"/>
1441
<xsl:with-param name="listLevel" select="$listLevel"/>
1442
<xsl:with-param name="listLevelStyle" select="$listLevelStyle"/>
1443
<xsl:with-param name="listStyle" select="$listStyle"/>
1444
<xsl:with-param name="precedingListItemsOfSameLevelAndStyle" select="$precedingListItemsOfSameLevelAndStyle"/>
1445
<xsl:with-param name="precedingListItemsOfSameLevelAndStyleCount" select="$precedingListItemsOfSameLevelAndStyleCount"/>
1446
<xsl:with-param name="precedingListItemsOfSameStyle" select="$precedingListItemsOfSameStyle"/>
1447
<xsl:with-param name="precedingListItemsOfSameStyleCount" select="$precedingListItemsOfSameStyleCount"/>
1448
<xsl:with-param name="pseudoLevel" select="$pseudoLevel" />
1449
</xsl:call-template>
1452
<!-- count on till you find a start-value or the end is reached -->
1453
<xsl:call-template name="countListItemTillStartValue">
1454
<xsl:with-param name="IteratorSameLevelAndStyle" select="$IteratorSameLevelAndStyle + 1" />
1455
<xsl:with-param name="IteratorSameStyle" select="$IteratorSameStyle + 1"/>
1456
<xsl:with-param name="itemNumber" select="$itemNumber + 1"/>
1457
<xsl:with-param name="listLevel" select="$listLevel"/>
1458
<xsl:with-param name="listLevelStyle" select="$listLevelStyle"/>
1459
<xsl:with-param name="listStyle" select="$listStyle"/>
1460
<xsl:with-param name="precedingListItemsOfSameLevelAndStyle" select="$precedingListItemsOfSameLevelAndStyle"/>
1461
<xsl:with-param name="precedingListItemsOfSameLevelAndStyleCount" select="$precedingListItemsOfSameLevelAndStyleCount"/>
1462
<xsl:with-param name="precedingListItemsOfSameStyle" select="$precedingListItemsOfSameStyle"/>
1463
<xsl:with-param name="precedingListItemsOfSameStyleCount" select="$precedingListItemsOfSameStyleCount"/>
1464
<xsl:with-param name="pseudoLevel" select="0" />
1465
</xsl:call-template>
1473
<!-- Creates the list label containing the number, which is separated by '.' between the levels.
1474
Depending on the levels to display (listLevelsToDisplay) -->
1475
<xsl:template name="createItemLabel">
1476
<xsl:param name="itemLabel" select="''"/>
1477
<xsl:param name="itemNumber" />
1478
<xsl:param name="listLevel" />
1479
<xsl:param name="listLevelStyle" />
1480
<xsl:param name="listLevelsToDisplay" />
1483
<xsl:when test="$listLevelsToDisplay < $listLevel">
1484
<xsl:call-template name="truncLabel">
1485
<xsl:with-param name="itemLabel" select="$itemLabel"/>
1486
<xsl:with-param name="itemNumber" select="$itemNumber" />
1487
<xsl:with-param name="listLevel" select="$listLevel"/>
1488
<xsl:with-param name="listLevelStyle" select="$listLevelStyle" />
1489
<xsl:with-param name="listLevelsToDisplay" select="$listLevelsToDisplay"/>
1490
</xsl:call-template>
1493
<xsl:variable name="numberedSymbol">
1494
<xsl:number value="$itemNumber" format="{$listLevelStyle/@style:num-format}"/>
1497
<xsl:when test="$listLevelsToDisplay != 1">
1498
<xsl:value-of select="concat($itemLabel, '.' , $numberedSymbol)"/>
1501
<xsl:value-of select="$numberedSymbol"/>
1508
<xsl:template name="truncLabel">
1509
<xsl:param name="itemLabel" />
1510
<xsl:param name="itemNumber" />
1511
<xsl:param name="listLevel" />
1512
<xsl:param name="listLevelStyle" />
1513
<xsl:param name="listLevelsToDisplay" />
1514
<xsl:param name="listStyle" />
1515
<xsl:param name="listStyleName" />
1517
<xsl:call-template name="createItemLabel">
1518
<xsl:with-param name="itemLabel">
1519
<xsl:if test="contains($itemLabel, '.')">
1520
<xsl:value-of select="substring-after($itemLabel, '.')"/>
1523
<xsl:with-param name="itemNumber" select="$itemNumber"/>
1524
<xsl:with-param name="listLevel" select="$listLevel - 1"/>
1525
<xsl:with-param name="listLevelStyle" select="$listLevelStyle"/>
1526
<xsl:with-param name="listLevelsToDisplay" select="$listLevelsToDisplay"/>
1527
<xsl:with-param name="listStyle" select="$listStyle"/>
1528
<xsl:with-param name="listStyleName" select="$listStyleName"/>
1529
</xsl:call-template>
1533
<xsl:template match="text:p" mode="first-list-child-margin-adaption">
1534
<xsl:param name="globalData"/>
1535
<xsl:param name="listLabelElement"/>
1536
<xsl:param name="isEmptyList"/>
1537
<xsl:param name="isListNumberingReset"/>
1538
<xsl:param name="isNextLevelNumberingReset"/>
1539
<xsl:param name="itemLabel"/>
1540
<xsl:param name="itemNumber"/>
1541
<xsl:param name="listIndent"/>
1542
<xsl:param name="listLevel"/>
1543
<xsl:param name="listRestart"/>
1544
<xsl:param name="listStyle"/>
1545
<xsl:param name="listStyleName"/>
1546
<xsl:param name="minLabelWidth"/>
1548
<xsl:element name="p">
1549
<xsl:call-template name="create-list-style">
1550
<xsl:with-param name="globalData" select="$globalData"/>
1551
<xsl:with-param name="listIndent" select="$listIndent"/>
1552
<xsl:with-param name="styleName" select="@text:style-name"/>
1553
</xsl:call-template>
1554
<xsl:if test="$listLabelElement">
1555
<xsl:copy-of select="$listLabelElement"/>
1557
<xsl:apply-templates>
1558
<xsl:with-param name="globalData" select="$globalData"/>
1559
<xsl:with-param name="listIndent" select="$minLabelWidth"/>
1560
</xsl:apply-templates>
1561
<xsl:if test="$listLabelElement">
1562
<!-- this span disables the float necessary to bring two block elements on one line. It contains a space as IE6 bug workaround -->
1563
<span class="odfLiEnd"></span>
1565
<xsl:text> </xsl:text>
1568
<xsl:apply-templates mode="first-list-child-margin-adaption" select="following-sibling::*[1]">
1569
<xsl:with-param name="globalData" select="$globalData"/>
1570
<xsl:with-param name="isEmptyList" select="$isEmptyList"/>
1571
<xsl:with-param name="isListNumberingReset" select="$isListNumberingReset"/>
1572
<xsl:with-param name="isNextLevelNumberingReset" select="$isNextLevelNumberingReset"/>
1573
<xsl:with-param name="itemLabel" select="$itemLabel"/>
1574
<xsl:with-param name="itemNumber" select="$itemNumber"/>
1575
<xsl:with-param name="listLevel" select="$listLevel"/>
1576
<xsl:with-param name="listRestart" select="$listRestart"/>
1577
<xsl:with-param name="listStyle" select="$listStyle"/>
1578
<xsl:with-param name="listStyleName" select="$listStyleName"/>
1579
<xsl:with-param name="listIndent" select="$listIndent"/>
1580
<xsl:with-param name="minLabelWidth" select="$minLabelWidth"/>
1581
</xsl:apply-templates>
1585
<!-- Neglecting the left margin behavior for headings for now -->
1586
<xsl:template match="text:h" mode="first-list-child-margin-adaption">
1587
<xsl:param name="globalData"/>
1588
<xsl:param name="listLabelElement"/>
1589
<xsl:param name="isEmptyList"/>
1590
<xsl:param name="isListNumberingReset"/>
1591
<xsl:param name="isNextLevelNumberingReset"/>
1592
<xsl:param name="itemLabel"/>
1593
<xsl:param name="itemNumber"/>
1594
<xsl:param name="listIndent"/>
1595
<xsl:param name="listLevel"/>
1596
<xsl:param name="listRestart"/>
1597
<xsl:param name="listStyle"/>
1598
<xsl:param name="listStyleName"/>
1599
<xsl:param name="minLabelWidth"/>
1601
<xsl:element name="h">
1602
<xsl:call-template name="create-list-style">
1603
<xsl:with-param name="globalData" select="$globalData"/>
1604
<xsl:with-param name="listIndent" select="$listIndent"/>
1605
<xsl:with-param name="styleName" select="@text:style-name"/>
1606
</xsl:call-template>
1607
<xsl:if test="$listLabelElement">
1608
<xsl:copy-of select="$listLabelElement"/>
1610
<xsl:apply-templates>
1611
<xsl:with-param name="globalData" select="$globalData"/>
1612
<xsl:with-param name="listIndent" select="$minLabelWidth"/>
1613
</xsl:apply-templates>
1614
<xsl:if test="$listLabelElement">
1615
<!-- this span disables the float necessary to bring two block elements on one line. It contains a space as IE6 bug workaround -->
1616
<span class="odfLiEnd"></span>
1618
<xsl:text> </xsl:text>
1621
<xsl:apply-templates mode="first-list-child-margin-adaption" select="following-sibling::*[1]">
1622
<xsl:with-param name="globalData" select="$globalData"/>
1623
<xsl:with-param name="isEmptyList" select="$isEmptyList"/>
1624
<xsl:with-param name="isListNumberingReset" select="$isListNumberingReset"/>
1625
<xsl:with-param name="isNextLevelNumberingReset" select="$isNextLevelNumberingReset"/>
1626
<xsl:with-param name="itemLabel" select="$itemLabel"/>
1627
<xsl:with-param name="itemNumber" select="$itemNumber"/>
1628
<xsl:with-param name="listLevel" select="$listLevel"/>
1629
<xsl:with-param name="listRestart" select="$listRestart"/>
1630
<xsl:with-param name="listStyle" select="$listStyle"/>
1631
<xsl:with-param name="listStyleName" select="$listStyleName"/>
1632
<xsl:with-param name="listIndent" select="$listIndent"/>
1633
<xsl:with-param name="minLabelWidth" select="$minLabelWidth"/>
1634
</xsl:apply-templates>
1638
<xsl:template match="*" mode="first-list-child-margin-adaption">
1639
<xsl:param name="globalData"/>
1640
<xsl:param name="isEmptyList"/>
1641
<xsl:param name="isListNumberingReset"/>
1642
<xsl:param name="isNextLevelNumberingReset"/>
1643
<xsl:param name="itemLabel"/>
1644
<xsl:param name="itemNumber"/>
1645
<xsl:param name="listIndent"/>
1646
<xsl:param name="listLevel"/>
1647
<xsl:param name="listRestart"/>
1648
<xsl:param name="listStyle"/>
1649
<xsl:param name="listStyleName"/>
1650
<xsl:param name="minLabelWidth"/>
1652
<xsl:apply-templates select="self::*" mode="listItemSibling">
1653
<xsl:with-param name="globalData" select="$globalData"/>
1654
<xsl:with-param name="isEmptyList" select="$isEmptyList"/>
1655
<xsl:with-param name="isListNumberingReset" select="$isListNumberingReset"/>
1656
<xsl:with-param name="isNextLevelNumberingReset" select="$isNextLevelNumberingReset"/>
1657
<xsl:with-param name="itemLabel" select="$itemLabel"/>
1658
<xsl:with-param name="itemNumber" select="$itemNumber"/>
1659
<xsl:with-param name="listIndent" select="$listIndent"/>
1660
<xsl:with-param name="listLevel" select="$listLevel"/>
1661
<xsl:with-param name="listRestart" select="$listRestart"/>
1662
<xsl:with-param name="listStyle" select="$listStyle"/>
1663
<xsl:with-param name="listStyleName" select="$listStyleName"/>
1664
</xsl:apply-templates>
1666
<xsl:apply-templates mode="first-list-child-margin-adaption" select="following-sibling::*[1]">
1667
<xsl:with-param name="globalData" select="$globalData"/>
1668
<xsl:with-param name="isEmptyList" select="$isEmptyList"/>
1669
<xsl:with-param name="isListNumberingReset" select="$isListNumberingReset"/>
1670
<xsl:with-param name="isNextLevelNumberingReset" select="$isNextLevelNumberingReset"/>
1671
<xsl:with-param name="itemLabel" select="$itemLabel"/>
1672
<xsl:with-param name="itemNumber" select="$itemNumber"/>
1673
<xsl:with-param name="listLevel" select="$listLevel"/>
1674
<xsl:with-param name="listRestart" select="$listRestart"/>
1675
<xsl:with-param name="listStyle" select="$listStyle"/>
1676
<xsl:with-param name="listStyleName" select="$listStyleName"/>
1677
<xsl:with-param name="listIndent" select="$listIndent"/>
1678
<xsl:with-param name="minLabelWidth" select="$minLabelWidth"/>
1679
</xsl:apply-templates>
1682
<xsl:template match="*" mode="listItemSibling">
1683
<xsl:param name="globalData"/>
1684
<xsl:param name="isEmptyList"/>
1685
<xsl:param name="isListNumberingReset"/>
1686
<xsl:param name="isNextLevelNumberingReset"/>
1687
<xsl:param name="itemLabel"/>
1688
<xsl:param name="itemNumber"/>
1689
<xsl:param name="listIndent"/>
1690
<xsl:param name="listLevel"/>
1691
<xsl:param name="listRestart"/>
1692
<xsl:param name="listStyle"/>
1693
<xsl:param name="listStyleName"/>
1695
<xsl:apply-templates select="self::*">
1696
<xsl:with-param name="globalData" select="$globalData"/>
1697
<xsl:with-param name="isEmptyList" select="$isEmptyList"/>
1698
<xsl:with-param name="isListNumberingReset" select="$isListNumberingReset"/>
1699
<xsl:with-param name="isNextLevelNumberingReset" select="$isNextLevelNumberingReset"/>
1700
<xsl:with-param name="itemNumber" select="$itemNumber"/>
1701
<xsl:with-param name="listIndent" select="$listIndent"/>
1702
<!-- receives the same parent label, only with a different itemNumber -->
1703
<xsl:with-param name="itemLabel" select="$itemLabel"/>
1704
<xsl:with-param name="listLevel" select="$listLevel"/>
1705
<xsl:with-param name="listStyle" select="$listStyle"/>
1706
<xsl:with-param name="listStyleName" select="$listStyleName"/>
1707
</xsl:apply-templates>
1708
<xsl:apply-templates select="following-sibling::*[1]" mode="listItemSibling">
1709
<xsl:with-param name="globalData" select="$globalData"/>
1710
<xsl:with-param name="isEmptyList" select="$isEmptyList"/>
1711
<xsl:with-param name="isListNumberingReset" select="$isListNumberingReset"/>
1712
<xsl:with-param name="isNextLevelNumberingReset" select="$isNextLevelNumberingReset"/>
1713
<xsl:with-param name="itemNumber" select="$itemNumber"/>
1714
<xsl:with-param name="listIndent" select="$listIndent"/>
1715
<!-- receives the same parent label, only with a different itemNumber -->
1716
<xsl:with-param name="itemLabel" select="$itemLabel"/>
1717
<xsl:with-param name="listLevel" select="$listLevel"/>
1718
<xsl:with-param name="listStyle" select="$listStyle"/>
1719
<xsl:with-param name="listStyleName" select="$listStyleName"/>
1720
</xsl:apply-templates>
1723
<xsl:template match="text()" mode="first-list-child-margin-adaption">
1724
<xsl:value-of select="."/>
1728
<xsl:template name="create-list-style">
1729
<xsl:param name="globalData"/>
1730
<xsl:param name="listIndent" select="0"/>
1731
<xsl:param name="styleName"/>
1733
<xsl:if test="$styleName">
1734
<xsl:attribute name="class">
1735
<xsl:value-of select="translate($styleName, '.,;: %()[]/\+', '_____________')"/>
1738
<xsl:attribute name="style">
1739
<xsl:text>margin-left:</xsl:text>
1740
<xsl:value-of select="$listIndent"/>
1741
<xsl:text>cm;</xsl:text>
1746
<!-- ********************************************** -->
1747
<!-- *** Text Section (contains: draw:text-box) *** -->
1748
<!-- ********************************************** -->
1750
<xsl:template match="text:section">
1751
<xsl:param name="globalData"/>
1753
<xsl:if test="not(contains(@text:display, 'none'))">
1754
<xsl:element name="div">
1755
<xsl:call-template name="apply-styles-and-content">
1756
<xsl:with-param name="globalData" select="$globalData"/>
1757
</xsl:call-template>
1763
<!-- Hidden text dependend on Office variables:
1764
The text is not shown, if condition is 'true'.
1765
Implemented solely for conditons as '<VARIABLE>==0' or '<VARIABLE>==1'
1767
<xsl:key match="text:variable-set" name="varSet" use="@text:name"/>
1768
<xsl:template match="text:hidden-text">
1769
<xsl:param name="globalData"/>
1771
<xsl:variable name="varName" select="substring-before(@text:condition, '==')"/>
1772
<xsl:variable name="varValue" select="substring-after(@text:condition, '==')"/>
1774
<xsl:when test="key('varSet', $varName)/@text:value != $varValue">
1775
<xsl:value-of select="@text:string-value"/>
1779
<xsl:value-of select="$varName"/>
1780
<xsl:value-of select="@text:string-value"/>
1781
<xsl:value-of select="$varName"/>
1788
<xsl:template match="@text:style-name | @draw:style-name | @draw:text-style-name | @table:style-name"><!-- | @presentation:style-name-->
1789
<xsl:param name="globalData"/>
1791
<xsl:attribute name="class">
1792
<xsl:value-of select="translate(., '.,;: %()[]/\+', '_____________')"/>
1797
<!-- ***************** -->
1798
<!-- *** Footnotes *** -->
1799
<!-- ***************** -->
1801
<xsl:template match="text:note">
1802
<xsl:param name="globalData"/>
1804
<!-- get style configuration -->
1805
<xsl:variable name="footnoteConfig" select="$globalData/office:styles/text:notes-configuration[@text:note-class=current()/@text:note-class]" />
1807
<xsl:variable name="titlePrefix">
1809
<xsl:when test="@text:note-class = 'footnote'">
1810
<xsl:text>Footnote: </xsl:text>
1813
<xsl:text>Endnote: </xsl:text>
1818
<!-- write anchor -->
1819
<xsl:element name="span">
1820
<xsl:attribute name="class"><xsl:value-of select="$footnoteConfig/@text:citation-body-style-name"/></xsl:attribute>
1821
<xsl:attribute name="title"><xsl:value-of select="$titlePrefix"/><xsl:apply-templates mode="textOnly" select="text:note-body"/></xsl:attribute>
1822
<xsl:element name="a">
1823
<xsl:attribute name="href"><xsl:value-of select="concat('#', @text:id)"/></xsl:attribute>
1824
<xsl:attribute name="id"><xsl:value-of select="concat('body_', @text:id)"/></xsl:attribute>
1825
<xsl:apply-templates mode="textOnly" select="text:note-citation"/>
1830
<xsl:template match="*" mode="textOnly">
1831
<xsl:apply-templates select="* | text()" mode="textOnly" />
1834
<xsl:template match="text()" mode="textOnly">
1835
<xsl:value-of select="."/>
1838
<!-- Useful in case of 'style:map', conditional formatting, where a style references to another -->
1839
<xsl:key name="textNotes" match="text:note" use="@text:note-class"/>
1841
<!-- writing the footer- and endnotes beyond the body -->
1842
<xsl:template name="write-text-nodes">
1843
<xsl:param name="globalData"/>
1845
<!-- write footnote body -->
1846
<xsl:for-each select="key('textNotes', 'footnote')">
1847
<xsl:call-template name="write-text-node">
1848
<xsl:with-param name="globalData" select="$globalData"/>
1849
<xsl:with-param name="footnoteConfig" select="$globalData/office:styles/text:notes-configuration[@text:note-class=current()/@text:note-class]" />
1850
</xsl:call-template>
1853
<!-- write endnote body -->
1854
<xsl:for-each select="key('textNotes', 'endnote')">
1855
<xsl:call-template name="write-text-node">
1857
<xsl:with-param name="globalData" select="$globalData"/>
1858
<xsl:with-param name="footnoteConfig" select="$globalData/office:styles/text:notes-configuration[@text:note-class=current()/@text:note-class]" />
1859
</xsl:call-template>
1863
<xsl:template name="write-text-node">
1864
<xsl:param name="globalData"/>
1865
<xsl:param name="footnoteConfig"/>
1867
<xsl:apply-templates select="text:note-body/node()">
1868
<xsl:with-param name="globalData" select="$globalData" />
1869
<xsl:with-param name="footnotePrefix">
1870
<xsl:element name="span">
1871
<xsl:attribute name="class">footnodeNumber</xsl:attribute>
1872
<xsl:element name="a">
1873
<xsl:attribute name="class"><xsl:value-of select="$footnoteConfig/@text:citation-style-name"/></xsl:attribute>
1874
<xsl:attribute name="id"><xsl:value-of select="@text:id"/></xsl:attribute>
1875
<xsl:attribute name="href"><xsl:value-of select="concat('#body_', @text:id)"/></xsl:attribute>
1876
<xsl:apply-templates mode="textOnly" select="text:note-citation"/>
1880
</xsl:apply-templates>
1885
<xsl:template match="text:tab">
1886
<xsl:param name="globalData"/>
1888
<xsl:element name="span">
1889
<!-- using as heuristic the first tab width of the 0paragraph style as margin-left -->
1890
<xsl:attribute name="style">margin-left:<xsl:value-of select="$globalData/all-doc-styles/style[@style:name = current()/ancestor::*/@text:style-name]/*/style:tab-stops/style:tab-stop/@style:position"/>;</xsl:attribute>
1896
<xsl:template match="draw:object[math:math]">
1897
<math xmlns="http://www.w3.org/1998/Math/MathML">
1898
<xsl:apply-templates select="math:math/math:semantics/*" mode="math"/>
1902
<xsl:template match="*" mode="math">
1903
<xsl:element name="{local-name()}" namespace="http://www.w3.org/1998/Math/MathML">
1904
<xsl:apply-templates select="@*|node()" mode="math"/>
1908
<xsl:template match="@*" mode="math">
1909
<xsl:attribute name="{local-name()}">
1910
<xsl:value-of select="."/>
1914
<xsl:template match="math:annotation" mode="math"/>
b'\\ No newline at end of file'