2
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
3
xmlns:doc="http://nwalsh.com/xsl/documentation/1.0"
4
xmlns:stbl="http://nwalsh.com/xslt/ext/com.nwalsh.saxon.Table"
5
xmlns:xtbl="xalan://com.nwalsh.xalan.Table"
6
xmlns:lxslt="http://xml.apache.org/xslt"
7
xmlns:ptbl="http://nwalsh.com/xslt/ext/xsltproc/python/Table"
8
exclude-result-prefixes="doc stbl xtbl lxslt ptbl"
11
<xsl:include href="../common/table.xsl"/>
13
<!-- ********************************************************************
14
$Id: table.xsl 8813 2010-08-09 21:18:23Z bobstayton $
15
********************************************************************
17
This file is part of the XSL DocBook Stylesheet distribution.
18
See ../README or http://docbook.sf.net/release/xsl/current/ for
19
copyright and other information.
21
******************************************************************** -->
23
<lxslt:component prefix="xtbl"
24
functions="adjustColumnWidths"/>
26
<xsl:template name="empty.table.cell">
27
<xsl:param name="colnum" select="0"/>
29
<xsl:variable name="rowsep">
31
<!-- If this is the last row, rowsep never applies. -->
32
<xsl:when test="not(ancestor-or-self::row[1]/following-sibling::row
33
or ancestor-or-self::thead/following-sibling::tbody
34
or ancestor-or-self::tbody/preceding-sibling::tfoot)">
35
<xsl:value-of select="0"/>
38
<xsl:call-template name="inherited.table.attribute">
39
<xsl:with-param name="entry" select="NOT-AN-ELEMENT-NAME"/>
40
<xsl:with-param name="row" select="ancestor-or-self::row[1]"/>
41
<xsl:with-param name="colnum" select="$colnum"/>
42
<xsl:with-param name="attribute" select="'rowsep'"/>
48
<xsl:variable name="colsep">
50
<!-- If this is the last column, colsep never applies. -->
51
<xsl:when test="number($colnum) >= ancestor::tgroup/@cols">0</xsl:when>
53
<xsl:call-template name="inherited.table.attribute">
54
<xsl:with-param name="entry" select="NOT-AN-ELEMENT-NAME"/>
55
<xsl:with-param name="row" select="ancestor-or-self::row[1]"/>
56
<xsl:with-param name="colnum" select="$colnum"/>
57
<xsl:with-param name="attribute" select="'colsep'"/>
63
<td class="auto-generated">
64
<xsl:if test="$table.borders.with.css != 0">
65
<xsl:attribute name="style">
66
<xsl:if test="$colsep > 0">
67
<xsl:call-template name="border">
68
<xsl:with-param name="side" select="'right'"/>
71
<xsl:if test="$rowsep > 0">
72
<xsl:call-template name="border">
73
<xsl:with-param name="side" select="'bottom'"/>
78
<xsl:text> </xsl:text>
82
<!-- ==================================================================== -->
84
<xsl:template name="border">
85
<xsl:param name="side" select="'left'"/>
86
<xsl:param name="padding" select="0"/>
87
<xsl:param name="style" select="$table.cell.border.style"/>
88
<xsl:param name="color" select="$table.cell.border.color"/>
89
<xsl:param name="thickness" select="$table.cell.border.thickness"/>
91
<!-- Note: Some browsers (mozilla) require at least a width and style. -->
94
<xsl:when test="($thickness != ''
99
or ($thickness != '')">
100
<!-- use the compound property if we can: -->
101
<!-- it saves space and probably works more reliably -->
102
<xsl:text>border-</xsl:text>
103
<xsl:value-of select="$side"/>
104
<xsl:text>: </xsl:text>
105
<xsl:value-of select="$thickness"/>
106
<xsl:text> </xsl:text>
107
<xsl:value-of select="$style"/>
108
<xsl:text> </xsl:text>
109
<xsl:value-of select="$color"/>
110
<xsl:text>; </xsl:text>
113
<!-- we need to specify the styles individually -->
114
<xsl:if test="$thickness != ''">
115
<xsl:text>border-</xsl:text>
116
<xsl:value-of select="$side"/>
117
<xsl:text>-width: </xsl:text>
118
<xsl:value-of select="$thickness"/>
119
<xsl:text>; </xsl:text>
122
<xsl:if test="$style != ''">
123
<xsl:text>border-</xsl:text>
124
<xsl:value-of select="$side"/>
125
<xsl:text>-style: </xsl:text>
126
<xsl:value-of select="$style"/>
127
<xsl:text>; </xsl:text>
130
<xsl:if test="$color != ''">
131
<xsl:text>border-</xsl:text>
132
<xsl:value-of select="$side"/>
133
<xsl:text>-color: </xsl:text>
134
<xsl:value-of select="$color"/>
135
<xsl:text>; </xsl:text>
141
<!-- ==================================================================== -->
143
<xsl:template match="tgroup" name="tgroup">
144
<xsl:if test="not(@cols) or @cols = '' or string(number(@cols)) = 'NaN'">
145
<xsl:message terminate="yes">
146
<xsl:text>Error: CALS tables must specify the number of columns.</xsl:text>
150
<xsl:variable name="summary">
151
<xsl:call-template name="pi.dbhtml_table-summary"/>
154
<xsl:variable name="cellspacing">
155
<xsl:call-template name="pi.dbhtml_cellspacing"/>
158
<xsl:variable name="cellpadding">
159
<xsl:call-template name="pi.dbhtml_cellpadding"/>
164
<!-- If there's a textobject/phrase for the table summary, use it -->
165
<xsl:when test="../textobject/phrase">
166
<xsl:attribute name="summary">
167
<xsl:value-of select="../textobject/phrase"/>
171
<!-- If there's a <?dbhtml table-summary="foo"?> PI, use it for
172
the HTML table summary attribute -->
173
<xsl:when test="$summary != ''">
174
<xsl:attribute name="summary">
175
<xsl:value-of select="$summary"/>
179
<!-- Otherwise, if there's a title, use that -->
180
<xsl:when test="../title">
181
<xsl:attribute name="summary">
182
<!-- This screws up on inline markup and footnotes, oh well... -->
183
<xsl:value-of select="string(../title)"/>
187
<!-- Otherwise, forget the whole idea -->
188
<xsl:otherwise><!-- nevermind --></xsl:otherwise>
191
<xsl:if test="$cellspacing != '' or $html.cellspacing != ''">
192
<xsl:attribute name="cellspacing">
194
<xsl:when test="$cellspacing != ''">
195
<xsl:value-of select="$cellspacing"/>
198
<xsl:value-of select="$html.cellspacing"/>
204
<xsl:if test="$cellpadding != '' or $html.cellpadding != ''">
205
<xsl:attribute name="cellpadding">
207
<xsl:when test="$cellpadding != ''">
208
<xsl:value-of select="$cellpadding"/>
211
<xsl:value-of select="$html.cellpadding"/>
217
<xsl:if test="../@pgwide=1 or local-name(.) = 'entrytbl'">
218
<xsl:attribute name="width">100%</xsl:attribute>
222
<xsl:when test="$table.borders.with.css != 0">
224
<xsl:when test="../@frame='all' or (not(../@frame) and $default.table.frame='all')">
225
<xsl:attribute name="style">
226
<xsl:text>border-collapse: collapse;</xsl:text>
227
<xsl:call-template name="border">
228
<xsl:with-param name="side" select="'top'"/>
229
<xsl:with-param name="style" select="$table.frame.border.style"/>
230
<xsl:with-param name="color" select="$table.frame.border.color"/>
231
<xsl:with-param name="thickness" select="$table.frame.border.thickness"/>
233
<xsl:call-template name="border">
234
<xsl:with-param name="side" select="'bottom'"/>
235
<xsl:with-param name="style" select="$table.frame.border.style"/>
236
<xsl:with-param name="color" select="$table.frame.border.color"/>
237
<xsl:with-param name="thickness" select="$table.frame.border.thickness"/>
239
<xsl:call-template name="border">
240
<xsl:with-param name="side" select="'left'"/>
241
<xsl:with-param name="style" select="$table.frame.border.style"/>
242
<xsl:with-param name="color" select="$table.frame.border.color"/>
243
<xsl:with-param name="thickness" select="$table.frame.border.thickness"/>
245
<xsl:call-template name="border">
246
<xsl:with-param name="side" select="'right'"/>
247
<xsl:with-param name="style" select="$table.frame.border.style"/>
248
<xsl:with-param name="color" select="$table.frame.border.color"/>
249
<xsl:with-param name="thickness" select="$table.frame.border.thickness"/>
253
<xsl:when test="../@frame='topbot' or (not(../@frame) and $default.table.frame='topbot')">
254
<xsl:attribute name="style">
255
<xsl:text>border-collapse: collapse;</xsl:text>
256
<xsl:call-template name="border">
257
<xsl:with-param name="side" select="'top'"/>
258
<xsl:with-param name="style" select="$table.frame.border.style"/>
259
<xsl:with-param name="color" select="$table.frame.border.color"/>
260
<xsl:with-param name="thickness" select="$table.frame.border.thickness"/>
262
<xsl:call-template name="border">
263
<xsl:with-param name="side" select="'bottom'"/>
264
<xsl:with-param name="style" select="$table.frame.border.style"/>
265
<xsl:with-param name="color" select="$table.frame.border.color"/>
266
<xsl:with-param name="thickness" select="$table.frame.border.thickness"/>
270
<xsl:when test="../@frame='top' or (not(../@frame) and $default.table.frame='top')">
271
<xsl:attribute name="style">
272
<xsl:text>border-collapse: collapse;</xsl:text>
273
<xsl:call-template name="border">
274
<xsl:with-param name="side" select="'top'"/>
275
<xsl:with-param name="style" select="$table.frame.border.style"/>
276
<xsl:with-param name="color" select="$table.frame.border.color"/>
277
<xsl:with-param name="thickness" select="$table.frame.border.thickness"/>
281
<xsl:when test="../@frame='bottom' or (not(../@frame) and $default.table.frame='bottom')">
282
<xsl:attribute name="style">
283
<xsl:text>border-collapse: collapse;</xsl:text>
284
<xsl:call-template name="border">
285
<xsl:with-param name="side" select="'bottom'"/>
286
<xsl:with-param name="style" select="$table.frame.border.style"/>
287
<xsl:with-param name="color" select="$table.frame.border.color"/>
288
<xsl:with-param name="thickness" select="$table.frame.border.thickness"/>
292
<xsl:when test="../@frame='sides' or (not(../@frame) and $default.table.frame='sides')">
293
<xsl:attribute name="style">
294
<xsl:text>border-collapse: collapse;</xsl:text>
295
<xsl:call-template name="border">
296
<xsl:with-param name="side" select="'left'"/>
297
<xsl:with-param name="style" select="$table.frame.border.style"/>
298
<xsl:with-param name="color" select="$table.frame.border.color"/>
299
<xsl:with-param name="thickness" select="$table.frame.border.thickness"/>
301
<xsl:call-template name="border">
302
<xsl:with-param name="side" select="'right'"/>
303
<xsl:with-param name="style" select="$table.frame.border.style"/>
304
<xsl:with-param name="color" select="$table.frame.border.color"/>
305
<xsl:with-param name="thickness" select="$table.frame.border.thickness"/>
309
<xsl:when test="../@frame='none'">
310
<xsl:attribute name="style">
311
<xsl:text>border: none;</xsl:text>
315
<xsl:attribute name="style">
316
<xsl:text>border-collapse: collapse;</xsl:text>
322
<xsl:when test="../@frame='none' or (not(../@frame) and $default.table.frame='none') or local-name(.) = 'entrytbl'">
323
<xsl:attribute name="border">0</xsl:attribute>
326
<xsl:attribute name="border">1</xsl:attribute>
330
<xsl:variable name="colgroup">
332
<xsl:call-template name="generate.colgroup">
333
<xsl:with-param name="cols" select="@cols"/>
338
<xsl:variable name="explicit.table.width">
339
<xsl:call-template name="pi.dbhtml_table-width">
340
<xsl:with-param name="node" select=".."/>
344
<xsl:variable name="table.width">
346
<xsl:when test="$explicit.table.width != ''">
347
<xsl:value-of select="$explicit.table.width"/>
349
<xsl:when test="$default.table.width = ''">
350
<xsl:text>100%</xsl:text>
353
<xsl:value-of select="$default.table.width"/>
358
<xsl:if test="$default.table.width != ''
359
or $explicit.table.width != ''">
360
<xsl:attribute name="width">
362
<xsl:when test="contains($table.width, '%')">
363
<xsl:value-of select="$table.width"/>
365
<xsl:when test="$use.extensions != 0
366
and $tablecolumns.extension != 0">
368
<xsl:when test="function-available('stbl:convertLength')">
369
<xsl:value-of select="stbl:convertLength($table.width)"/>
371
<xsl:when test="function-available('xtbl:convertLength')">
372
<xsl:value-of select="xtbl:convertLength($table.width)"/>
375
<xsl:message terminate="yes">
376
<xsl:text>No convertLength function available.</xsl:text>
382
<xsl:value-of select="$table.width"/>
389
<xsl:when test="$use.extensions != 0
390
and $tablecolumns.extension != 0">
392
<xsl:when test="function-available('stbl:adjustColumnWidths')">
393
<xsl:copy-of select="stbl:adjustColumnWidths($colgroup)"/>
395
<xsl:when test="function-available('xtbl:adjustColumnWidths')">
396
<xsl:copy-of select="xtbl:adjustColumnWidths($colgroup)"/>
398
<xsl:when test="function-available('ptbl:adjustColumnWidths')">
399
<xsl:copy-of select="ptbl:adjustColumnWidths($colgroup)"/>
402
<xsl:message terminate="yes">
403
<xsl:text>No adjustColumnWidths function available.</xsl:text>
409
<xsl:copy-of select="$colgroup"/>
413
<xsl:apply-templates select="thead"/>
414
<xsl:apply-templates select="tfoot"/>
415
<xsl:apply-templates select="tbody"/>
417
<xsl:if test=".//footnote|../title//footnote">
418
<tbody class="footnotes">
420
<td colspan="{@cols}">
421
<xsl:apply-templates select=".//footnote|../title//footnote" mode="table.footnote.mode"/>
429
<xsl:template match="tgroup/processing-instruction('dbhtml')">
430
<xsl:variable name="summary">
431
<xsl:call-template name="pi.dbhtml_table-summary"/>
434
<!-- Suppress the table-summary PI -->
435
<xsl:if test="$summary = ''">
436
<xsl:processing-instruction name="dbhtml">
437
<xsl:value-of select="."/>
438
</xsl:processing-instruction>
442
<xsl:template match="colspec"></xsl:template>
444
<xsl:template match="spanspec"></xsl:template>
446
<xsl:template match="thead|tfoot">
447
<xsl:element name="{local-name(.)}">
448
<xsl:if test="@align">
449
<xsl:attribute name="align">
450
<xsl:value-of select="@align"/>
453
<xsl:if test="@char">
454
<xsl:attribute name="char">
455
<xsl:value-of select="@char"/>
458
<xsl:if test="@charoff">
459
<xsl:attribute name="charoff">
460
<xsl:value-of select="@charoff"/>
463
<xsl:if test="@valign">
464
<xsl:attribute name="valign">
465
<xsl:value-of select="@valign"/>
470
<!-- recurse on rows only if @morerows is present -->
471
<xsl:when test="row/entry/@morerows|row/entrytbl/@morerows">
472
<xsl:apply-templates select="row[1]">
473
<xsl:with-param name="spans">
474
<xsl:call-template name="blank.spans">
475
<xsl:with-param name="cols" select="../@cols"/>
478
<xsl:with-param name="browserows" select="'recurse'"/>
479
</xsl:apply-templates>
482
<xsl:apply-templates select="row">
483
<xsl:with-param name="spans">
484
<xsl:call-template name="blank.spans">
485
<xsl:with-param name="cols" select="../@cols"/>
488
<xsl:with-param name="browserows" select="'loop'" />
489
</xsl:apply-templates>
496
<xsl:template match="tbody">
498
<xsl:if test="@align">
499
<xsl:attribute name="align">
500
<xsl:value-of select="@align"/>
503
<xsl:if test="@char">
504
<xsl:attribute name="char">
505
<xsl:value-of select="@char"/>
508
<xsl:if test="@charoff">
509
<xsl:attribute name="charoff">
510
<xsl:value-of select="@charoff"/>
513
<xsl:if test="@valign">
514
<xsl:attribute name="valign">
515
<xsl:value-of select="@valign"/>
520
<xsl:when test="row/entry/@morerows|row/entrytbl/@morerows">
521
<xsl:apply-templates select="row[1]">
522
<xsl:with-param name="spans">
523
<xsl:call-template name="blank.spans">
524
<xsl:with-param name="cols" select="../@cols"/>
527
<xsl:with-param name="browserows" select="'recurse'"/>
528
</xsl:apply-templates>
531
<xsl:apply-templates select="row">
532
<xsl:with-param name="spans">
533
<xsl:call-template name="blank.spans">
534
<xsl:with-param name="cols" select="../@cols"/>
537
<xsl:with-param name="browserows" select="'loop'" />
538
</xsl:apply-templates>
545
<xsl:template match="row">
546
<xsl:param name="spans"/>
547
<xsl:param name="browserows"/>
550
<xsl:when test="contains($spans, '0')">
551
<xsl:call-template name="normal-row">
552
<xsl:with-param name="spans" select="$spans"/>
553
<xsl:with-param name="browserows" select="$browserows"/>
559
<xsl:text>Ignoring row: </xsl:text>
560
<xsl:value-of select="$spans"/>
561
<xsl:text> = </xsl:text>
562
<xsl:call-template name="consume-row">
563
<xsl:with-param name="spans" select="$spans"/>
568
<xsl:if test="normalize-space(.//text()) != ''">
569
<xsl:message>Warning: overlapped row contains content!</xsl:message>
572
<tr><xsl:comment> This row intentionally left blank </xsl:comment></tr>
574
<xsl:if test="$browserows = 'recurse'">
575
<xsl:apply-templates select="following-sibling::row[1]">
576
<xsl:with-param name="spans">
577
<xsl:call-template name="consume-row">
578
<xsl:with-param name="spans" select="$spans"/>
581
<xsl:with-param name="browserows" select="$browserows"/>
582
</xsl:apply-templates>
588
<xsl:template name="normal-row">
589
<xsl:param name="spans"/>
590
<xsl:param name="browserows"/>
592
<xsl:variable name="row-height">
593
<xsl:if test="processing-instruction('dbhtml')">
594
<xsl:call-template name="pi.dbhtml_row-height"/>
598
<xsl:variable name="bgcolor">
599
<xsl:if test="processing-instruction('dbhtml')">
600
<xsl:call-template name="pi.dbhtml_bgcolor"/>
604
<xsl:variable name="class">
605
<xsl:if test="processing-instruction('dbhtml')">
606
<xsl:call-template name="pi.dbhtml_class"/>
611
<xsl:call-template name="tr.attributes">
612
<xsl:with-param name="rownum">
613
<xsl:number from="tgroup" count="row"/>
617
<xsl:if test="$row-height != ''">
618
<xsl:attribute name="height">
619
<xsl:value-of select="$row-height"/>
623
<xsl:if test="$bgcolor != ''">
624
<xsl:attribute name="bgcolor">
625
<xsl:value-of select="$bgcolor"/>
629
<xsl:if test="$class != ''">
630
<xsl:attribute name="class">
631
<xsl:value-of select="$class"/>
635
<xsl:if test="$table.borders.with.css != 0">
636
<xsl:if test="@rowsep = 1 and following-sibling::row">
637
<xsl:attribute name="style">
638
<xsl:call-template name="border">
639
<xsl:with-param name="side" select="'bottom'"/>
645
<xsl:if test="@align">
646
<xsl:attribute name="align">
647
<xsl:value-of select="@align"/>
650
<xsl:if test="@char">
651
<xsl:attribute name="char">
652
<xsl:value-of select="@char"/>
655
<xsl:if test="@charoff">
656
<xsl:attribute name="charoff">
657
<xsl:value-of select="@charoff"/>
660
<xsl:if test="@valign">
661
<xsl:attribute name="valign">
662
<xsl:value-of select="@valign"/>
666
<xsl:apply-templates select="(entry|entrytbl)[1]">
667
<xsl:with-param name="spans" select="$spans"/>
668
</xsl:apply-templates>
671
<xsl:if test="$browserows = 'recurse'">
672
<xsl:if test="following-sibling::row">
673
<xsl:variable name="nextspans">
674
<xsl:apply-templates select="(entry|entrytbl)[1]" mode="span">
675
<xsl:with-param name="spans" select="$spans"/>
676
</xsl:apply-templates>
679
<xsl:apply-templates select="following-sibling::row[1]">
680
<xsl:with-param name="spans" select="$nextspans"/>
681
<xsl:with-param name="browserows" select="$browserows"/>
682
</xsl:apply-templates>
687
<xsl:template match="entry|entrytbl" name="entry">
688
<xsl:param name="col">
690
<xsl:when test="@revisionflag">
691
<xsl:number from="row"/>
693
<xsl:otherwise>1</xsl:otherwise>
697
<xsl:param name="spans"/>
699
<xsl:variable name="cellgi">
701
<xsl:when test="ancestor::thead">th</xsl:when>
702
<xsl:when test="ancestor::tfoot">th</xsl:when>
703
<xsl:when test="ancestor::tbody and
704
(ancestor::table[@rowheader = 'firstcol'] or
705
ancestor::informaltable[@rowheader = 'firstcol']) and
706
ancestor-or-self::entry[1][count(preceding-sibling::entry) = 0]">
707
<xsl:text>th</xsl:text>
709
<xsl:otherwise>td</xsl:otherwise>
713
<xsl:variable name="empty.cell" select="count(node()) = 0"/>
715
<xsl:variable name="named.colnum">
716
<xsl:call-template name="entry.colnum"/>
719
<xsl:variable name="entry.colnum">
721
<xsl:when test="$named.colnum > 0">
722
<xsl:value-of select="$named.colnum"/>
725
<xsl:value-of select="$col"/>
730
<xsl:variable name="entry.colspan">
732
<xsl:when test="@spanname or @namest">
733
<xsl:call-template name="calculate.colspan"/>
735
<xsl:otherwise>1</xsl:otherwise>
739
<xsl:variable name="following.spans">
740
<xsl:call-template name="calculate.following.spans">
741
<xsl:with-param name="colspan" select="$entry.colspan"/>
742
<xsl:with-param name="spans" select="$spans"/>
746
<xsl:variable name="rowsep">
748
<!-- If this is the last row, rowsep never applies. -->
749
<xsl:when test="ancestor::entrytbl
750
and not (ancestor-or-self::row[1]/following-sibling::row)
751
and not (ancestor::thead)">
752
<xsl:value-of select="0"/>
754
<xsl:when test="not(ancestor-or-self::row[1]/following-sibling::row
755
or ancestor-or-self::thead/following-sibling::tbody
756
or ancestor-or-self::tbody/preceding-sibling::tfoot)">
757
<xsl:value-of select="0"/>
759
<xsl:when test="@morerows and not(@morerows <
760
count(ancestor-or-self::row[1]/following-sibling::row))">
761
<xsl:value-of select="0"/>
764
<xsl:call-template name="inherited.table.attribute">
765
<xsl:with-param name="entry" select="."/>
766
<xsl:with-param name="colnum" select="$entry.colnum"/>
767
<xsl:with-param name="attribute" select="'rowsep'"/>
773
<xsl:variable name="colsep">
775
<!-- If this is the last column, colsep never applies. -->
776
<xsl:when test="$following.spans = ''">0</xsl:when>
778
<xsl:call-template name="inherited.table.attribute">
779
<xsl:with-param name="entry" select="."/>
780
<xsl:with-param name="colnum" select="$entry.colnum"/>
781
<xsl:with-param name="attribute" select="'colsep'"/>
787
<xsl:variable name="valign">
788
<xsl:call-template name="inherited.table.attribute">
789
<xsl:with-param name="entry" select="."/>
790
<xsl:with-param name="colnum" select="$entry.colnum"/>
791
<xsl:with-param name="attribute" select="'valign'"/>
795
<xsl:variable name="align">
796
<xsl:call-template name="inherited.table.attribute">
797
<xsl:with-param name="entry" select="."/>
798
<xsl:with-param name="colnum" select="$entry.colnum"/>
799
<xsl:with-param name="attribute" select="'align'"/>
803
<xsl:variable name="char">
804
<xsl:call-template name="inherited.table.attribute">
805
<xsl:with-param name="entry" select="."/>
806
<xsl:with-param name="colnum" select="$entry.colnum"/>
807
<xsl:with-param name="attribute" select="'char'"/>
811
<xsl:variable name="charoff">
812
<xsl:call-template name="inherited.table.attribute">
813
<xsl:with-param name="entry" select="."/>
814
<xsl:with-param name="colnum" select="$entry.colnum"/>
815
<xsl:with-param name="attribute" select="'charoff'"/>
820
<xsl:when test="$spans != '' and not(starts-with($spans,'0:'))">
821
<xsl:call-template name="entry">
822
<xsl:with-param name="col" select="$col+1"/>
823
<xsl:with-param name="spans" select="substring-after($spans,':')"/>
827
<xsl:when test="number($entry.colnum) > $col">
828
<xsl:call-template name="empty.table.cell"/>
829
<xsl:call-template name="entry">
830
<xsl:with-param name="col" select="$col+1"/>
831
<xsl:with-param name="spans" select="substring-after($spans,':')"/>
836
<xsl:variable name="bgcolor">
837
<xsl:if test="processing-instruction('dbhtml')">
838
<xsl:call-template name="pi.dbhtml_bgcolor"/>
842
<xsl:element name="{$cellgi}">
843
<xsl:if test="$bgcolor != ''">
844
<xsl:attribute name="bgcolor">
845
<xsl:value-of select="$bgcolor"/>
849
<xsl:call-template name="locale.html.attributes"/>
850
<xsl:if test="$entry.propagates.style != 0 and @role">
851
<xsl:apply-templates select="." mode="class.attribute">
852
<xsl:with-param name="class" select="@role"/>
853
</xsl:apply-templates>
856
<xsl:if test="$show.revisionflag and @revisionflag">
857
<xsl:attribute name="class">
858
<xsl:value-of select="@revisionflag"/>
862
<xsl:if test="$table.borders.with.css != 0">
863
<xsl:attribute name="style">
864
<xsl:if test="$colsep > 0">
865
<xsl:call-template name="border">
866
<xsl:with-param name="side" select="'right'"/>
869
<xsl:if test="$rowsep > 0">
870
<xsl:call-template name="border">
871
<xsl:with-param name="side" select="'bottom'"/>
877
<xsl:if test="@morerows > 0">
878
<xsl:attribute name="rowspan">
879
<xsl:value-of select="1+@morerows"/>
883
<xsl:if test="$entry.colspan > 1">
884
<xsl:attribute name="colspan">
885
<xsl:value-of select="$entry.colspan"/>
889
<xsl:if test="$align != ''">
890
<xsl:attribute name="align">
891
<xsl:value-of select="$align"/>
895
<xsl:if test="$valign != ''">
896
<xsl:attribute name="valign">
897
<xsl:value-of select="$valign"/>
901
<xsl:if test="$char != ''">
902
<xsl:attribute name="char">
903
<xsl:value-of select="$char"/>
907
<xsl:if test="$charoff != ''">
908
<xsl:attribute name="charoff">
909
<xsl:value-of select="$charoff"/>
913
<xsl:if test="not(preceding-sibling::*) and
914
(ancestor::row[1]/@id or ancestor::row[1]/@xml:id)">
915
<xsl:call-template name="anchor">
916
<xsl:with-param name="node" select="ancestor::row[1]"/>
920
<xsl:call-template name="anchor"/>
923
<xsl:when test="$empty.cell">
924
<xsl:text> </xsl:text>
926
<xsl:when test="self::entrytbl">
927
<xsl:call-template name="tgroup"/>
930
<xsl:apply-templates/>
936
<xsl:when test="following-sibling::entry|following-sibling::entrytbl">
937
<xsl:apply-templates select="(following-sibling::entry
938
|following-sibling::entrytbl)[1]">
939
<xsl:with-param name="col" select="$col+$entry.colspan"/>
940
<xsl:with-param name="spans" select="$following.spans"/>
941
</xsl:apply-templates>
944
<xsl:call-template name="finaltd">
945
<xsl:with-param name="spans" select="$following.spans"/>
946
<xsl:with-param name="col" select="$col+$entry.colspan"/>
954
<xsl:template match="entry|entrytbl" name="sentry" mode="span">
955
<xsl:param name="col" select="1"/>
956
<xsl:param name="spans"/>
958
<xsl:variable name="entry.colnum">
959
<xsl:call-template name="entry.colnum"/>
962
<xsl:variable name="entry.colspan">
964
<xsl:when test="@spanname or @namest">
965
<xsl:call-template name="calculate.colspan"/>
967
<xsl:otherwise>1</xsl:otherwise>
971
<xsl:variable name="following.spans">
972
<xsl:call-template name="calculate.following.spans">
973
<xsl:with-param name="colspan" select="$entry.colspan"/>
974
<xsl:with-param name="spans" select="$spans"/>
979
<xsl:when test="$spans != '' and not(starts-with($spans,'0:'))">
980
<xsl:value-of select="substring-before($spans,':')-1"/>
981
<xsl:text>:</xsl:text>
982
<xsl:call-template name="sentry">
983
<xsl:with-param name="col" select="$col+1"/>
984
<xsl:with-param name="spans" select="substring-after($spans,':')"/>
988
<xsl:when test="number($entry.colnum) > $col">
989
<xsl:text>0:</xsl:text>
990
<xsl:call-template name="sentry">
991
<xsl:with-param name="col" select="$col + 1"/>
992
<xsl:with-param name="spans" select="substring-after($spans,':')"/>
997
<xsl:call-template name="copy-string">
998
<xsl:with-param name="count" select="$entry.colspan"/>
999
<xsl:with-param name="string">
1001
<xsl:when test="@morerows">
1002
<xsl:value-of select="@morerows"/>
1004
<xsl:otherwise>0</xsl:otherwise>
1006
<xsl:text>:</xsl:text>
1008
</xsl:call-template>
1011
<xsl:when test="following-sibling::entry|following-sibling::entrytbl">
1012
<xsl:apply-templates select="(following-sibling::entry
1013
|following-sibling::entrytbl)[1]"
1015
<xsl:with-param name="col" select="$col+$entry.colspan"/>
1016
<xsl:with-param name="spans" select="$following.spans"/>
1017
</xsl:apply-templates>
1020
<xsl:call-template name="sfinaltd">
1021
<xsl:with-param name="spans" select="$following.spans"/>
1022
</xsl:call-template>
1029
<xsl:template name="generate.colgroup">
1030
<xsl:param name="cols" select="1"/>
1031
<xsl:param name="count" select="1"/>
1033
<xsl:when test="$count > $cols"></xsl:when>
1035
<xsl:call-template name="generate.col">
1036
<xsl:with-param name="countcol" select="$count"/>
1037
</xsl:call-template>
1038
<xsl:call-template name="generate.colgroup">
1039
<xsl:with-param name="cols" select="$cols"/>
1040
<xsl:with-param name="count" select="$count+1"/>
1041
</xsl:call-template>
1046
<xsl:template name="generate.col">
1047
<xsl:param name="countcol">1</xsl:param>
1048
<xsl:param name="colspecs" select="./colspec"/>
1049
<xsl:param name="count">1</xsl:param>
1050
<xsl:param name="colnum">1</xsl:param>
1053
<xsl:when test="$count>count($colspecs)">
1057
<xsl:variable name="colspec" select="$colspecs[$count=position()]"/>
1058
<xsl:variable name="colspec.colnum">
1060
<xsl:when test="$colspec/@colnum">
1061
<xsl:value-of select="$colspec/@colnum"/>
1064
<xsl:value-of select="$colnum"/>
1070
<xsl:when test="$colspec.colnum=$countcol">
1073
<xsl:when test="$colspec/@colwidth
1074
and $use.extensions != 0
1075
and $tablecolumns.extension != 0">
1076
<xsl:attribute name="width">
1078
<xsl:when test="normalize-space($colspec/@colwidth) = '*'">
1079
<xsl:value-of select="'1*'"/>
1082
<xsl:value-of select="$colspec/@colwidth"/>
1087
<!-- pass through to HTML if no * in colspecs -->
1088
<xsl:when test="$colspec/@colwidth and
1089
not($colspec/parent::*/colspec/@colwidth[contains(.,'*')])">
1090
<xsl:attribute name="width">
1092
<xsl:when test="normalize-space($colspec/@colwidth) = '*'">
1093
<xsl:value-of select="'1*'"/>
1096
<xsl:value-of select="$colspec/@colwidth"/>
1104
<xsl:when test="$colspec/@align">
1105
<xsl:attribute name="align">
1106
<xsl:value-of select="$colspec/@align"/>
1109
<!-- Suggested by Pavel ZAMPACH <zampach@nemcb.cz> -->
1110
<xsl:when test="$colspecs/ancestor::tgroup/@align">
1111
<xsl:attribute name="align">
1112
<xsl:value-of select="$colspecs/ancestor::tgroup/@align"/>
1117
<xsl:if test="$colspec/@char">
1118
<xsl:attribute name="char">
1119
<xsl:value-of select="$colspec/@char"/>
1123
<xsl:if test="$colspec/@charoff">
1124
<xsl:attribute name="charoff">
1125
<xsl:value-of select="$colspec/@charoff"/>
1129
<xsl:if test="$colspec/@colname">
1130
<xsl:attribute name="class">
1131
<xsl:value-of select="$colspec/@colname"/>
1137
<xsl:call-template name="generate.col">
1138
<xsl:with-param name="countcol" select="$countcol"/>
1139
<xsl:with-param name="colspecs" select="$colspecs"/>
1140
<xsl:with-param name="count" select="$count+1"/>
1141
<xsl:with-param name="colnum">
1143
<xsl:when test="$colspec/@colnum">
1144
<xsl:value-of select="$colspec/@colnum + 1"/>
1147
<xsl:value-of select="$colnum + 1"/>
1151
</xsl:call-template>
1158
<xsl:template name="colspec.colwidth">
1159
<!-- when this macro is called, the current context must be an entry -->
1160
<xsl:param name="colname"></xsl:param>
1161
<!-- .. = row, ../.. = thead|tbody, ../../.. = tgroup -->
1162
<xsl:param name="colspecs" select="../../../../tgroup/colspec"/>
1163
<xsl:param name="count">1</xsl:param>
1165
<xsl:when test="$count>count($colspecs)"></xsl:when>
1167
<xsl:variable name="colspec" select="$colspecs[$count=position()]"/>
1169
<xsl:when test="$colspec/@colname=$colname">
1170
<xsl:value-of select="$colspec/@colwidth"/>
1173
<xsl:call-template name="colspec.colwidth">
1174
<xsl:with-param name="colname" select="$colname"/>
1175
<xsl:with-param name="colspecs" select="$colspecs"/>
1176
<xsl:with-param name="count" select="$count+1"/>
1177
</xsl:call-template>
1184
<!-- ====================================================================== -->
1186
<xsl:template name="tr.attributes">
1187
<xsl:param name="row" select="."/>
1188
<xsl:param name="rownum" select="0"/>
1190
<!-- by default, do nothing. But you might want to say:
1192
<xsl:if test="$rownum mod 2 = 0">
1193
<xsl:attribute name="class">oddrow</xsl:attribute>