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: table_columns.xsl,v $
14
This file is part of OpenOffice.org.
16
OpenOffice.org is free software: you can redistribute it and/or modify
17
it under the terms of the GNU Lesser General Public License version 3
18
only, as published by the Free Software Foundation.
20
OpenOffice.org is distributed in the hope that it will be useful,
21
but WITHOUT ANY WARRANTY; without even the implied warranty of
22
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
23
GNU Lesser General Public License version 3 for more details
24
(a copy is included in the LICENSE file that accompanied this code).
26
You should have received a copy of the GNU Lesser General Public License
27
version 3 along with OpenOffice.org. If not, see
28
<http://www.openoffice.org/license.html>
29
for a copy of the LGPLv3 License.
33
For further documentation and updates visit http://xml.openoffice.org/odf2xhtml
35
<xsl:stylesheet version="1.0"
36
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
37
xmlns:chart="urn:oasis:names:tc:opendocument:xmlns:chart:1.0"
38
xmlns:config="urn:oasis:names:tc:opendocument:xmlns:config:1.0"
39
xmlns:dc="http://purl.org/dc/elements/1.1/"
40
xmlns:dom="http://www.w3.org/2001/xml-events"
41
xmlns:dr3d="urn:oasis:names:tc:opendocument:xmlns:dr3d:1.0"
42
xmlns:draw="urn:oasis:names:tc:opendocument:xmlns:drawing:1.0"
43
xmlns:fo="urn:oasis:names:tc:opendocument:xmlns:xsl-fo-compatible:1.0"
44
xmlns:form="urn:oasis:names:tc:opendocument:xmlns:form:1.0"
45
xmlns:math="http://www.w3.org/1998/Math/MathML"
46
xmlns:meta="urn:oasis:names:tc:opendocument:xmlns:meta:1.0"
47
xmlns:number="urn:oasis:names:tc:opendocument:xmlns:datastyle:1.0"
48
xmlns:office="urn:oasis:names:tc:opendocument:xmlns:office:1.0"
49
xmlns:ooo="http://openoffice.org/2004/office"
50
xmlns:oooc="http://openoffice.org/2004/calc"
51
xmlns:ooow="http://openoffice.org/2004/writer"
52
xmlns:script="urn:oasis:names:tc:opendocument:xmlns:script:1.0"
53
xmlns:style="urn:oasis:names:tc:opendocument:xmlns:style:1.0"
54
xmlns:svg="urn:oasis:names:tc:opendocument:xmlns:svg-compatible:1.0"
55
xmlns:table="urn:oasis:names:tc:opendocument:xmlns:table:1.0"
56
xmlns:text="urn:oasis:names:tc:opendocument:xmlns:text:1.0"
57
xmlns:xforms="http://www.w3.org/2002/xforms"
58
xmlns:xlink="http://www.w3.org/1999/xlink"
59
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
60
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
61
xmlns:xt="http://www.jclark.com/xt"
62
xmlns:common="http://exslt.org/common"
63
xmlns:xalan="http://xml.apache.org/xalan"
64
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 xt common xalan">
66
<xsl:param name="tableColumnElement" select="'col'" />
68
<!-- ******************************************** -->
69
<!-- *** Create table columns style variable *** -->
70
<!-- ******************************************** -->
72
<!-- current node is a table:table -->
73
<xsl:template name="create-column-style-variable">
74
<xsl:param name="globalData" />
75
<xsl:param name="allVisibleTableRows" />
77
<!-- all columns of the table -->
78
<xsl:variable name="allTableColumns" select="table:table-column |
79
table:table-column-group/descendant::table:table-column |
80
table:table-header-columns/descendant::table:table-column" />
81
<!-- allTableColumns: Containing all columns of the table, hidden and viewed.
82
- if a column is hidden, if table:visibility has the value 'collapse' or 'filter', otherwise the value is 'visible'
83
- if a column is being repeated, each repeated column is explicitly written as entry in this variable.
84
Later (during template "write-cell") the style of the column will be mixed with the cell-style by using
85
the position() of the column entry and comparing it with the iterating cell number. -->
86
<xsl:variable name="allTableColumns-RTF">
87
<xsl:for-each select="$allTableColumns">
88
<xsl:call-template name="adding-column-styles-entries">
89
<xsl:with-param name="globalData" select="$globalData" />
90
<xsl:with-param name="allTableColumns" select="$allTableColumns" />
96
<xsl:when test="function-available('common:node-set')">
97
<xsl:call-template name="create-table-children">
98
<xsl:with-param name="globalData" select="$globalData" />
99
<xsl:with-param name="allVisibleTableRows" select="$allVisibleTableRows" />
100
<xsl:with-param name="allTableColumns" select="common:node-set($allTableColumns-RTF)" />
103
<xsl:when test="function-available('xalan:nodeset')">
104
<xsl:call-template name="create-table-children">
105
<xsl:with-param name="globalData" select="$globalData" />
106
<xsl:with-param name="allVisibleTableRows" select="$allVisibleTableRows" />
107
<xsl:with-param name="allTableColumns" select="xalan:nodeset($allTableColumns-RTF)" />
110
<xsl:when test="function-available('xt:node-set')">
111
<xsl:call-template name="create-table-children">
112
<xsl:with-param name="globalData" select="$globalData" />
113
<xsl:with-param name="allVisibleTableRows" select="$allVisibleTableRows" />
114
<xsl:with-param name="allTableColumns" select="xt:node-set($allTableColumns-RTF)" />
120
<!-- current node is a table:table -->
121
<xsl:template name="create-table-children">
122
<xsl:param name="globalData" />
123
<xsl:param name="allVisibleTableRows" />
124
<xsl:param name="allTableColumns" />
127
<xsl:for-each select="$allTableColumns/table:table-column">
128
<xsl:if test="not(@table:visibility = 'collapse' or @table:visibility = 'filter')">
130
<xsl:call-template name="create-column-element">
131
<xsl:with-param name="globalData" select="$globalData" />
132
<xsl:with-param name="allVisibleTableRows" select="$allVisibleTableRows" />
133
<xsl:with-param name="allTableColumns" select="$allTableColumns" />
138
<xsl:call-template name="create-table-rows">
139
<xsl:with-param name="globalData" select="$globalData" />
140
<xsl:with-param name="allVisibleTableRows" select="$allVisibleTableRows" />
141
<xsl:with-param name="allTableColumns" select="$allTableColumns" />
145
<!-- To be OVERWRITTEN -->
146
<xsl:template name="create-column-element" />
148
<!-- current node is a table:table-column -->
149
<xsl:template name="adding-column-styles-entries">
150
<xsl:param name="globalData" />
151
<xsl:param name="allTableColumns" />
154
<!-- if parser reads DTD the default is set to '1' -->
155
<xsl:when test="not(@table:number-columns-repeated and @table:number-columns-repeated > 1)">
156
<!-- writes an entry of a column in the columns-variable -->
157
<xsl:copy-of select="." />
159
<!-- No higher repetition of cells greater than 99 for the last and second last column.
160
This is a workaround for some sample document (Waehrungsumrechner.sxc),
161
having 230 repeated columns in the second last column to emulate background -->
162
<!-- NOTE: Testcase with a table containing table:table-column-group and/or table:table-header-columns -->
163
<xsl:when test="(last() or (last() - 1)) and @table:number-columns-repeated > 99">
164
<!-- writes an entry of a column in the columns-variable -->
165
<xsl:call-template name="repeat-adding-table-column">
166
<xsl:with-param name="numberColumnsRepeated" select="1" />
170
<!-- repeated colums will be written explicit several times in the variable-->
171
<xsl:call-template name="repeat-adding-table-column">
172
<xsl:with-param name="numberColumnsRepeated" select="@table:number-columns-repeated" />
179
<!-- WRITES THE REPEATED COLUMN STYLE EXPLICIT AS AN ELEMENT IN THE COLUMNS-VARIABLE -->
180
<!-- current node is a table:table-column -->
181
<xsl:template name="repeat-adding-table-column">
182
<xsl:param name="table:table-column" />
183
<xsl:param name="numberColumnsRepeated" />
187
<xsl:when test="$numberColumnsRepeated > 1">
188
<!-- writes an entry of a column in the columns-variable -->
189
<xsl:copy-of select="." />
190
<!-- repeat calling this method until all elements written out -->
191
<xsl:call-template name="repeat-adding-table-column">
192
<xsl:with-param name="numberColumnsRepeated" select="$numberColumnsRepeated - 1" />
196
<!-- writes an entry of a column in the columns-variable -->
197
<xsl:copy-of select="." />
203
<!--debugEnabled-START-->
204
<!-- giving out the 'allColumnStyle' variable:
205
For each 'table:table-column' of the 'allTableColumns' variable the style-name is given out.
206
In case of 'column-hidden-flag' attribute the text 'Column is hidden is given out.-->
207
<!-- current node is a table:table -->
208
<xsl:template name="table-debug-allTableColumns">
209
<xsl:param name="allTableColumns" />
211
<!-- debug output as table summary attribut in html -->
212
<xsl:attribute name="summary">
213
<xsl:call-template name="table-debug-column-out">
214
<xsl:with-param name="allTableColumns" select="$allTableColumns" />
217
<!-- debug output to console -->
219
<xsl:call-template name="table-debug-column-out">
220
<xsl:with-param name="allTableColumns" select="$allTableColumns" />
225
<!-- current node is a table:table -->
226
<xsl:template name="table-debug-column-out">
227
<xsl:param name="allTableColumns" />
229
DebugInformation: For each 'table:table-column' of the 'allTableColumns' variable the style-name is given out.
230
In case of table:visibility attribute unequal 'visible' the 'column is hidden' no text is given out.
232
<xsl:for-each select="$allTableColumns/table:table-column">
234
<xsl:when test="@table:visibility = 'collapse' or @table:visibility = 'filter' ">
235
<xsl:text> </xsl:text><xsl:value-of select="@table:style-name" /><xsl:text>column is hidden</xsl:text><xsl:text>
239
<xsl:text> </xsl:text><xsl:value-of select="@table:style-name" /><xsl:text> </xsl:text><xsl:value-of select="@table:default-cell-style-name" /><xsl:text>
245
<!--debugEnabled-END-->