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,v 1.1 2007/03/10 05:15:13 scott Exp $
15 ********************************************************************
17 This file is part of the XSL DocBook Stylesheet distribution.
18 See ../README or http://nwalsh.com/docbook/xsl/ for copyright
19 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=
"dbhtml-attribute">
152 <xsl:with-param name=
"pis"
153 select=
"processing-instruction('dbhtml')"/>
154 <xsl:with-param name=
"attribute" select=
"'table-summary'"/>
158 <xsl:variable name=
"cellspacing">
159 <xsl:call-template name=
"dbhtml-attribute">
160 <xsl:with-param name=
"pis"
161 select=
"processing-instruction('dbhtml')"/>
162 <xsl:with-param name=
"attribute" select=
"'cellspacing'"/>
166 <xsl:variable name=
"cellpadding">
167 <xsl:call-template name=
"dbhtml-attribute">
168 <xsl:with-param name=
"pis"
169 select=
"processing-instruction('dbhtml')[1]"/>
170 <xsl:with-param name=
"attribute" select=
"'cellpadding'"/>
176 <!-- If there's a textobject/phrase for the table summary, use it -->
177 <xsl:when test=
"../textobject/phrase">
178 <xsl:attribute name=
"summary">
179 <xsl:value-of select=
"../textobject/phrase"/>
183 <!-- If there's a <?dbhtml table-summary="foo"?> PI, use it for
184 the HTML table summary attribute -->
185 <xsl:when test=
"$summary != ''">
186 <xsl:attribute name=
"summary">
187 <xsl:value-of select=
"$summary"/>
191 <!-- Otherwise, if there's a title, use that -->
192 <xsl:when test=
"../title">
193 <xsl:attribute name=
"summary">
194 <xsl:value-of select=
"string(../title)"/>
198 <!-- Otherwise, forget the whole idea -->
199 <xsl:otherwise><!-- nevermind --></xsl:otherwise>
202 <xsl:if test=
"$cellspacing != '' or $html.cellspacing != ''">
203 <xsl:attribute name=
"cellspacing">
205 <xsl:when test=
"$cellspacing != ''">
206 <xsl:value-of select=
"$cellspacing"/>
209 <xsl:value-of select=
"$html.cellspacing"/>
215 <xsl:if test=
"$cellpadding != '' or $html.cellpadding != ''">
216 <xsl:attribute name=
"cellpadding">
218 <xsl:when test=
"$cellpadding != ''">
219 <xsl:value-of select=
"$cellpadding"/>
222 <xsl:value-of select=
"$html.cellpadding"/>
228 <xsl:if test=
"../@pgwide=1 or local-name(.) = 'entrytbl'">
229 <xsl:attribute name=
"width">100%
</xsl:attribute>
233 <xsl:when test=
"$table.borders.with.css != 0">
234 <xsl:attribute name=
"border">0</xsl:attribute>
236 <xsl:when test=
"../@frame='all' or (not(../@frame) and $default.table.frame='all')">
237 <xsl:attribute name=
"style">
238 <xsl:text>border-collapse: collapse;
</xsl:text>
239 <xsl:call-template name=
"border">
240 <xsl:with-param name=
"side" select=
"'top'"/>
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=
"'bottom'"/>
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"/>
251 <xsl:call-template name=
"border">
252 <xsl:with-param name=
"side" select=
"'left'"/>
253 <xsl:with-param name=
"style" select=
"$table.frame.border.style"/>
254 <xsl:with-param name=
"color" select=
"$table.frame.border.color"/>
255 <xsl:with-param name=
"thickness" select=
"$table.frame.border.thickness"/>
257 <xsl:call-template name=
"border">
258 <xsl:with-param name=
"side" select=
"'right'"/>
259 <xsl:with-param name=
"style" select=
"$table.frame.border.style"/>
260 <xsl:with-param name=
"color" select=
"$table.frame.border.color"/>
261 <xsl:with-param name=
"thickness" select=
"$table.frame.border.thickness"/>
265 <xsl:when test=
"../@frame='topbot' or (not(../@frame) and $default.table.frame='topbot')">
266 <xsl:attribute name=
"style">
267 <xsl:text>border-collapse: collapse;
</xsl:text>
268 <xsl:call-template name=
"border">
269 <xsl:with-param name=
"side" select=
"'top'"/>
270 <xsl:with-param name=
"style" select=
"$table.frame.border.style"/>
271 <xsl:with-param name=
"color" select=
"$table.frame.border.color"/>
272 <xsl:with-param name=
"thickness" select=
"$table.frame.border.thickness"/>
274 <xsl:call-template name=
"border">
275 <xsl:with-param name=
"side" select=
"'bottom'"/>
276 <xsl:with-param name=
"style" select=
"$table.frame.border.style"/>
277 <xsl:with-param name=
"color" select=
"$table.frame.border.color"/>
278 <xsl:with-param name=
"thickness" select=
"$table.frame.border.thickness"/>
282 <xsl:when test=
"../@frame='top' or (not(../@frame) and $default.table.frame='top')">
283 <xsl:attribute name=
"style">
284 <xsl:text>border-collapse: collapse;
</xsl:text>
285 <xsl:call-template name=
"border">
286 <xsl:with-param name=
"side" select=
"'top'"/>
287 <xsl:with-param name=
"style" select=
"$table.frame.border.style"/>
288 <xsl:with-param name=
"color" select=
"$table.frame.border.color"/>
289 <xsl:with-param name=
"thickness" select=
"$table.frame.border.thickness"/>
293 <xsl:when test=
"../@frame='bottom' or (not(../@frame) and $default.table.frame='bottom')">
294 <xsl:attribute name=
"style">
295 <xsl:text>border-collapse: collapse;
</xsl:text>
296 <xsl:call-template name=
"border">
297 <xsl:with-param name=
"side" select=
"'bottom'"/>
298 <xsl:with-param name=
"style" select=
"$table.frame.border.style"/>
299 <xsl:with-param name=
"color" select=
"$table.frame.border.color"/>
300 <xsl:with-param name=
"thickness" select=
"$table.frame.border.thickness"/>
304 <xsl:when test=
"../@frame='sides' or (not(../@frame) and $default.table.frame='sides')">
305 <xsl:attribute name=
"style">
306 <xsl:text>border-collapse: collapse;
</xsl:text>
307 <xsl:call-template name=
"border">
308 <xsl:with-param name=
"side" select=
"'left'"/>
309 <xsl:with-param name=
"style" select=
"$table.frame.border.style"/>
310 <xsl:with-param name=
"color" select=
"$table.frame.border.color"/>
311 <xsl:with-param name=
"thickness" select=
"$table.frame.border.thickness"/>
313 <xsl:call-template name=
"border">
314 <xsl:with-param name=
"side" select=
"'right'"/>
315 <xsl:with-param name=
"style" select=
"$table.frame.border.style"/>
316 <xsl:with-param name=
"color" select=
"$table.frame.border.color"/>
317 <xsl:with-param name=
"thickness" select=
"$table.frame.border.thickness"/>
322 <xsl:attribute name=
"style">
323 <xsl:text>border-collapse: collapse;
</xsl:text>
328 <xsl:when test=
"../@frame='none' or (not(../@frame) and $default.table.frame='none') or local-name(.) = 'entrytbl'">
329 <xsl:attribute name=
"border">0</xsl:attribute>
332 <xsl:attribute name=
"border">1</xsl:attribute>
336 <xsl:variable name=
"colgroup">
338 <xsl:call-template name=
"generate.colgroup">
339 <xsl:with-param name=
"cols" select=
"@cols"/>
344 <xsl:variable name=
"explicit.table.width">
345 <xsl:call-template name=
"dbhtml-attribute">
346 <xsl:with-param name=
"pis"
347 select=
"../processing-instruction('dbhtml')[1]"/>
348 <xsl:with-param name=
"attribute" select=
"'table-width'"/>
352 <xsl:variable name=
"table.width">
354 <xsl:when test=
"$explicit.table.width != ''">
355 <xsl:value-of select=
"$explicit.table.width"/>
357 <xsl:when test=
"$default.table.width = ''">
358 <xsl:text>100%
</xsl:text>
361 <xsl:value-of select=
"$default.table.width"/>
366 <xsl:if test=
"$default.table.width != ''
367 or $explicit.table.width != ''">
368 <xsl:attribute name=
"width">
370 <xsl:when test=
"contains($table.width, '%')">
371 <xsl:value-of select=
"$table.width"/>
373 <xsl:when test=
"$use.extensions != 0
374 and $tablecolumns.extension != 0">
376 <xsl:when test=
"function-available('stbl:convertLength')">
377 <xsl:value-of select=
"stbl:convertLength($table.width)"/>
379 <xsl:when test=
"function-available('xtbl:convertLength')">
380 <xsl:value-of select=
"xtbl:convertLength($table.width)"/>
383 <xsl:message terminate=
"yes">
384 <xsl:text>No convertLength function available.
</xsl:text>
390 <xsl:value-of select=
"$table.width"/>
397 <xsl:when test=
"$use.extensions != 0
398 and $tablecolumns.extension != 0">
400 <xsl:when test=
"function-available('stbl:adjustColumnWidths')">
401 <xsl:copy-of select=
"stbl:adjustColumnWidths($colgroup)"/>
403 <xsl:when test=
"function-available('xtbl:adjustColumnWidths')">
404 <xsl:copy-of select=
"xtbl:adjustColumnWidths($colgroup)"/>
406 <xsl:when test=
"function-available('ptbl:adjustColumnWidths')">
407 <xsl:copy-of select=
"ptbl:adjustColumnWidths($colgroup)"/>
410 <xsl:message terminate=
"yes">
411 <xsl:text>No adjustColumnWidths function available.
</xsl:text>
417 <xsl:copy-of select=
"$colgroup"/>
421 <xsl:apply-templates select=
"thead"/>
422 <xsl:apply-templates select=
"tfoot"/>
423 <xsl:apply-templates select=
"tbody"/>
425 <xsl:if test=
".//footnote">
426 <tbody class=
"footnotes">
428 <td colspan=
"{@cols}">
429 <xsl:apply-templates select=
".//footnote" mode=
"table.footnote.mode"/>
437 <xsl:template match=
"tgroup/processing-instruction('dbhtml')">
438 <xsl:variable name=
"summary">
439 <xsl:call-template name=
"dbhtml-attribute">
440 <xsl:with-param name=
"pis" select=
"."/>
441 <xsl:with-param name=
"attribute" select=
"'table-summary'"/>
445 <!-- Suppress the table-summary PI -->
446 <xsl:if test=
"$summary = ''">
447 <xsl:processing-instruction name=
"dbhtml">
448 <xsl:value-of select=
"."/>
449 </xsl:processing-instruction>
453 <xsl:template match=
"colspec"></xsl:template>
455 <xsl:template match=
"spanspec"></xsl:template>
457 <xsl:template match=
"thead|tfoot">
458 <xsl:element name=
"{local-name(.)}">
459 <xsl:if test=
"@align">
460 <xsl:attribute name=
"align">
461 <xsl:value-of select=
"@align"/>
464 <xsl:if test=
"@char">
465 <xsl:attribute name=
"char">
466 <xsl:value-of select=
"@char"/>
469 <xsl:if test=
"@charoff">
470 <xsl:attribute name=
"charoff">
471 <xsl:value-of select=
"@charoff"/>
474 <xsl:if test=
"@valign">
475 <xsl:attribute name=
"valign">
476 <xsl:value-of select=
"@valign"/>
480 <xsl:apply-templates select=
"row[1]">
481 <xsl:with-param name=
"spans">
482 <xsl:call-template name=
"blank.spans">
483 <xsl:with-param name=
"cols" select=
"../@cols"/>
486 </xsl:apply-templates>
491 <xsl:template match=
"tbody">
493 <xsl:if test=
"@align">
494 <xsl:attribute name=
"align">
495 <xsl:value-of select=
"@align"/>
498 <xsl:if test=
"@char">
499 <xsl:attribute name=
"char">
500 <xsl:value-of select=
"@char"/>
503 <xsl:if test=
"@charoff">
504 <xsl:attribute name=
"charoff">
505 <xsl:value-of select=
"@charoff"/>
508 <xsl:if test=
"@valign">
509 <xsl:attribute name=
"valign">
510 <xsl:value-of select=
"@valign"/>
514 <xsl:apply-templates select=
"row[1]">
515 <xsl:with-param name=
"spans">
516 <xsl:call-template name=
"blank.spans">
517 <xsl:with-param name=
"cols" select=
"../@cols"/>
520 </xsl:apply-templates>
525 <xsl:template match=
"row">
526 <xsl:param name=
"spans"/>
529 <xsl:when test=
"contains($spans, '0')">
530 <xsl:call-template name=
"normal-row">
531 <xsl:with-param name=
"spans" select=
"$spans"/>
537 <xsl:text>Ignoring row: </xsl:text>
538 <xsl:value-of select="$spans"/>
539 <xsl:text> = </xsl:text>
540 <xsl:call-template name="consume-row">
541 <xsl:with-param name="spans" select="$spans"/>
546 <xsl:if test=
"normalize-space(.//text()) != ''">
547 <xsl:message>Warning: overlapped row contains content!
</xsl:message>
550 <tr><xsl:comment> This row intentionally left blank
</xsl:comment></tr>
552 <xsl:apply-templates select=
"following-sibling::row[1]">
553 <xsl:with-param name=
"spans">
554 <xsl:call-template name=
"consume-row">
555 <xsl:with-param name=
"spans" select=
"$spans"/>
558 </xsl:apply-templates>
563 <xsl:template name=
"normal-row">
564 <xsl:param name=
"spans"/>
566 <xsl:variable name=
"row-height">
567 <xsl:if test=
"processing-instruction('dbhtml')">
568 <xsl:call-template name=
"dbhtml-attribute">
569 <xsl:with-param name=
"pis" select=
"processing-instruction('dbhtml')"/>
570 <xsl:with-param name=
"attribute" select=
"'row-height'"/>
575 <xsl:variable name=
"bgcolor">
576 <xsl:if test=
"processing-instruction('dbhtml')">
577 <xsl:call-template name=
"dbhtml-attribute">
578 <xsl:with-param name=
"pis" select=
"processing-instruction('dbhtml')"/>
579 <xsl:with-param name=
"attribute" select=
"'bgcolor'"/>
584 <xsl:variable name=
"class">
585 <xsl:if test=
"processing-instruction('dbhtml')">
586 <xsl:call-template name=
"dbhtml-attribute">
587 <xsl:with-param name=
"pis" select=
"processing-instruction('dbhtml')"/>
588 <xsl:with-param name=
"attribute" select=
"'class'"/>
594 <xsl:call-template name=
"tr.attributes">
595 <xsl:with-param name=
"rownum">
596 <xsl:number from=
"tgroup" count=
"row"/>
600 <xsl:if test=
"$row-height != ''">
601 <xsl:attribute name=
"height">
602 <xsl:value-of select=
"$row-height"/>
606 <xsl:if test=
"$bgcolor != ''">
607 <xsl:attribute name=
"bgcolor">
608 <xsl:value-of select=
"$bgcolor"/>
612 <xsl:if test=
"$class != ''">
613 <xsl:attribute name=
"class">
614 <xsl:value-of select=
"$class"/>
618 <xsl:if test=
"$table.borders.with.css != 0">
619 <xsl:if test=
"@rowsep = 1 and following-sibling::row">
620 <xsl:attribute name=
"style">
621 <xsl:call-template name=
"border">
622 <xsl:with-param name=
"side" select=
"'bottom'"/>
628 <xsl:if test=
"@align">
629 <xsl:attribute name=
"align">
630 <xsl:value-of select=
"@align"/>
633 <xsl:if test=
"@char">
634 <xsl:attribute name=
"char">
635 <xsl:value-of select=
"@char"/>
638 <xsl:if test=
"@charoff">
639 <xsl:attribute name=
"charoff">
640 <xsl:value-of select=
"@charoff"/>
643 <xsl:if test=
"@valign">
644 <xsl:attribute name=
"valign">
645 <xsl:value-of select=
"@valign"/>
649 <xsl:apply-templates select=
"(entry|entrytbl)[1]">
650 <xsl:with-param name=
"spans" select=
"$spans"/>
651 </xsl:apply-templates>
654 <xsl:if test=
"following-sibling::row">
655 <xsl:variable name=
"nextspans">
656 <xsl:apply-templates select=
"(entry|entrytbl)[1]" mode=
"span">
657 <xsl:with-param name=
"spans" select=
"$spans"/>
658 </xsl:apply-templates>
661 <xsl:apply-templates select=
"following-sibling::row[1]">
662 <xsl:with-param name=
"spans" select=
"$nextspans"/>
663 </xsl:apply-templates>
667 <xsl:template match=
"entry|entrytbl" name=
"entry">
668 <xsl:param name=
"col" select=
"1"/>
669 <xsl:param name=
"spans"/>
671 <xsl:variable name=
"cellgi">
673 <xsl:when test=
"ancestor::thead">th
</xsl:when>
674 <xsl:when test=
"ancestor::tfoot">th
</xsl:when>
675 <xsl:otherwise>td
</xsl:otherwise>
679 <xsl:variable name=
"empty.cell" select=
"count(node()) = 0"/>
681 <xsl:variable name=
"named.colnum">
682 <xsl:call-template name=
"entry.colnum"/>
685 <xsl:variable name=
"entry.colnum">
687 <xsl:when test=
"$named.colnum > 0">
688 <xsl:value-of select=
"$named.colnum"/>
691 <xsl:value-of select=
"$col"/>
696 <xsl:variable name=
"entry.colspan">
698 <xsl:when test=
"@spanname or @namest">
699 <xsl:call-template name=
"calculate.colspan"/>
701 <xsl:otherwise>1</xsl:otherwise>
705 <xsl:variable name=
"following.spans">
706 <xsl:call-template name=
"calculate.following.spans">
707 <xsl:with-param name=
"colspan" select=
"$entry.colspan"/>
708 <xsl:with-param name=
"spans" select=
"$spans"/>
712 <xsl:variable name=
"rowsep">
714 <!-- If this is the last row, rowsep never applies. -->
715 <xsl:when test=
"ancestor::entrytbl
716 and not (ancestor-or-self::row[1]/following-sibling::row)">
717 <xsl:value-of select=
"0"/>
719 <xsl:when test=
"not(ancestor-or-self::row[1]/following-sibling::row
720 or ancestor-or-self::thead/following-sibling::tbody
721 or ancestor-or-self::tbody/preceding-sibling::tfoot)">
722 <xsl:value-of select=
"0"/>
724 <xsl:when test=
"@morerows and not(@morerows <
725 count(ancestor-or-self::row[1]/following-sibling::row))">
726 <xsl:value-of select=
"0"/>
729 <xsl:call-template name=
"inherited.table.attribute">
730 <xsl:with-param name=
"entry" select=
"."/>
731 <xsl:with-param name=
"colnum" select=
"$entry.colnum"/>
732 <xsl:with-param name=
"attribute" select=
"'rowsep'"/>
738 <xsl:variable name=
"colsep">
740 <!-- If this is the last column, colsep never applies. -->
741 <xsl:when test=
"$following.spans = ''">0</xsl:when>
743 <xsl:call-template name=
"inherited.table.attribute">
744 <xsl:with-param name=
"entry" select=
"."/>
745 <xsl:with-param name=
"colnum" select=
"$entry.colnum"/>
746 <xsl:with-param name=
"attribute" select=
"'colsep'"/>
752 <xsl:variable name=
"valign">
753 <xsl:call-template name=
"inherited.table.attribute">
754 <xsl:with-param name=
"entry" select=
"."/>
755 <xsl:with-param name=
"colnum" select=
"$entry.colnum"/>
756 <xsl:with-param name=
"attribute" select=
"'valign'"/>
760 <xsl:variable name=
"align">
761 <xsl:call-template name=
"inherited.table.attribute">
762 <xsl:with-param name=
"entry" select=
"."/>
763 <xsl:with-param name=
"colnum" select=
"$entry.colnum"/>
764 <xsl:with-param name=
"attribute" select=
"'align'"/>
768 <xsl:variable name=
"char">
769 <xsl:call-template name=
"inherited.table.attribute">
770 <xsl:with-param name=
"entry" select=
"."/>
771 <xsl:with-param name=
"colnum" select=
"$entry.colnum"/>
772 <xsl:with-param name=
"attribute" select=
"'char'"/>
776 <xsl:variable name=
"charoff">
777 <xsl:call-template name=
"inherited.table.attribute">
778 <xsl:with-param name=
"entry" select=
"."/>
779 <xsl:with-param name=
"colnum" select=
"$entry.colnum"/>
780 <xsl:with-param name=
"attribute" select=
"'charoff'"/>
785 <xsl:when test=
"$spans != '' and not(starts-with($spans,'0:'))">
786 <xsl:call-template name=
"entry">
787 <xsl:with-param name=
"col" select=
"$col+1"/>
788 <xsl:with-param name=
"spans" select=
"substring-after($spans,':')"/>
792 <xsl:when test=
"number($entry.colnum) > $col">
793 <xsl:call-template name=
"empty.table.cell"/>
794 <xsl:call-template name=
"entry">
795 <xsl:with-param name=
"col" select=
"$col+1"/>
796 <xsl:with-param name=
"spans" select=
"substring-after($spans,':')"/>
801 <xsl:variable name=
"bgcolor">
802 <xsl:if test=
"processing-instruction('dbhtml')">
803 <xsl:call-template name=
"dbhtml-attribute">
804 <xsl:with-param name=
"pis" select=
"processing-instruction('dbhtml')"/>
805 <xsl:with-param name=
"attribute" select=
"'bgcolor'"/>
810 <xsl:element name=
"{$cellgi}">
811 <xsl:if test=
"$bgcolor != ''">
812 <xsl:attribute name=
"bgcolor">
813 <xsl:value-of select=
"$bgcolor"/>
817 <xsl:if test=
"$entry.propagates.style != 0 and @role">
818 <xsl:apply-templates select=
"." mode=
"class.attribute">
819 <xsl:with-param name=
"class" select=
"@role"/>
820 </xsl:apply-templates>
823 <xsl:if test=
"$show.revisionflag and @revisionflag">
824 <xsl:attribute name=
"class">
825 <xsl:value-of select=
"@revisionflag"/>
829 <xsl:if test=
"$table.borders.with.css != 0">
830 <xsl:attribute name=
"style">
831 <xsl:if test=
"$colsep > 0">
832 <xsl:call-template name=
"border">
833 <xsl:with-param name=
"side" select=
"'right'"/>
836 <xsl:if test=
"$rowsep > 0">
837 <xsl:call-template name=
"border">
838 <xsl:with-param name=
"side" select=
"'bottom'"/>
844 <xsl:if test=
"@morerows > 0">
845 <xsl:attribute name=
"rowspan">
846 <xsl:value-of select=
"1+@morerows"/>
850 <xsl:if test=
"$entry.colspan > 1">
851 <xsl:attribute name=
"colspan">
852 <xsl:value-of select=
"$entry.colspan"/>
856 <xsl:if test=
"$align != ''">
857 <xsl:attribute name=
"align">
858 <xsl:value-of select=
"$align"/>
862 <xsl:if test=
"$valign != ''">
863 <xsl:attribute name=
"valign">
864 <xsl:value-of select=
"$valign"/>
868 <xsl:if test=
"$char != ''">
869 <xsl:attribute name=
"char">
870 <xsl:value-of select=
"$char"/>
874 <xsl:if test=
"$charoff != ''">
875 <xsl:attribute name=
"charoff">
876 <xsl:value-of select=
"$charoff"/>
880 <xsl:if test=
"not(preceding-sibling::*) and
881 (ancestor::row[1]/@id or ancestor::row[1]/@xml:id)">
882 <xsl:call-template name=
"anchor">
883 <xsl:with-param name=
"node" select=
"ancestor::row[1]"/>
887 <xsl:call-template name=
"anchor"/>
890 <xsl:when test=
"$empty.cell">
891 <xsl:text> </xsl:text>
893 <xsl:when test=
"self::entrytbl">
894 <xsl:call-template name=
"tgroup"/>
897 <xsl:apply-templates/>
903 <xsl:when test=
"following-sibling::entry|following-sibling::entrytbl">
904 <xsl:apply-templates select=
"(following-sibling::entry
905 |following-sibling::entrytbl)[1]">
906 <xsl:with-param name=
"col" select=
"$col+$entry.colspan"/>
907 <xsl:with-param name=
"spans" select=
"$following.spans"/>
908 </xsl:apply-templates>
911 <xsl:call-template name=
"finaltd">
912 <xsl:with-param name=
"spans" select=
"$following.spans"/>
913 <xsl:with-param name=
"col" select=
"$col+$entry.colspan"/>
921 <xsl:template match=
"entry|entrytbl" name=
"sentry" mode=
"span">
922 <xsl:param name=
"col" select=
"1"/>
923 <xsl:param name=
"spans"/>
925 <xsl:variable name=
"entry.colnum">
926 <xsl:call-template name=
"entry.colnum"/>
929 <xsl:variable name=
"entry.colspan">
931 <xsl:when test=
"@spanname or @namest">
932 <xsl:call-template name=
"calculate.colspan"/>
934 <xsl:otherwise>1</xsl:otherwise>
938 <xsl:variable name=
"following.spans">
939 <xsl:call-template name=
"calculate.following.spans">
940 <xsl:with-param name=
"colspan" select=
"$entry.colspan"/>
941 <xsl:with-param name=
"spans" select=
"$spans"/>
946 <xsl:when test=
"$spans != '' and not(starts-with($spans,'0:'))">
947 <xsl:value-of select=
"substring-before($spans,':')-1"/>
948 <xsl:text>:
</xsl:text>
949 <xsl:call-template name=
"sentry">
950 <xsl:with-param name=
"col" select=
"$col+1"/>
951 <xsl:with-param name=
"spans" select=
"substring-after($spans,':')"/>
955 <xsl:when test=
"number($entry.colnum) > $col">
956 <xsl:text>0:
</xsl:text>
957 <xsl:call-template name=
"sentry">
958 <xsl:with-param name=
"col" select=
"$col+$entry.colspan"/>
959 <xsl:with-param name=
"spans" select=
"$following.spans"/>
964 <xsl:call-template name=
"copy-string">
965 <xsl:with-param name=
"count" select=
"$entry.colspan"/>
966 <xsl:with-param name=
"string">
968 <xsl:when test=
"@morerows">
969 <xsl:value-of select=
"@morerows"/>
971 <xsl:otherwise>0</xsl:otherwise>
973 <xsl:text>:
</xsl:text>
978 <xsl:when test=
"following-sibling::entry|following-sibling::entrytbl">
979 <xsl:apply-templates select=
"(following-sibling::entry
980 |following-sibling::entrytbl)[1]"
982 <xsl:with-param name=
"col" select=
"$col+$entry.colspan"/>
983 <xsl:with-param name=
"spans" select=
"$following.spans"/>
984 </xsl:apply-templates>
987 <xsl:call-template name=
"sfinaltd">
988 <xsl:with-param name=
"spans" select=
"$following.spans"/>
996 <xsl:template name=
"generate.colgroup">
997 <xsl:param name=
"cols" select=
"1"/>
998 <xsl:param name=
"count" select=
"1"/>
1000 <xsl:when test=
"$count > $cols"></xsl:when>
1002 <xsl:call-template name=
"generate.col">
1003 <xsl:with-param name=
"countcol" select=
"$count"/>
1004 </xsl:call-template>
1005 <xsl:call-template name=
"generate.colgroup">
1006 <xsl:with-param name=
"cols" select=
"$cols"/>
1007 <xsl:with-param name=
"count" select=
"$count+1"/>
1008 </xsl:call-template>
1013 <xsl:template name=
"generate.col">
1014 <xsl:param name=
"countcol">1</xsl:param>
1015 <xsl:param name=
"colspecs" select=
"./colspec"/>
1016 <xsl:param name=
"count">1</xsl:param>
1017 <xsl:param name=
"colnum">1</xsl:param>
1020 <xsl:when test=
"$count>count($colspecs)">
1024 <xsl:variable name=
"colspec" select=
"$colspecs[$count=position()]"/>
1025 <xsl:variable name=
"colspec.colnum">
1027 <xsl:when test=
"$colspec/@colnum">
1028 <xsl:value-of select=
"$colspec/@colnum"/>
1031 <xsl:value-of select=
"$colnum"/>
1037 <xsl:when test=
"$colspec.colnum=$countcol">
1039 <xsl:if test=
"$colspec/@colwidth
1040 and $use.extensions != 0
1041 and $tablecolumns.extension != 0">
1042 <xsl:attribute name=
"width">
1044 <xsl:when test=
"normalize-space($colspec/@colwidth) = '*'">
1045 <xsl:value-of select=
"'1*'"/>
1048 <xsl:value-of select=
"$colspec/@colwidth"/>
1055 <xsl:when test=
"$colspec/@align">
1056 <xsl:attribute name=
"align">
1057 <xsl:value-of select=
"$colspec/@align"/>
1060 <!-- Suggested by Pavel ZAMPACH <zampach@nemcb.cz> -->
1061 <xsl:when test=
"$colspecs/ancestor::tgroup/@align">
1062 <xsl:attribute name=
"align">
1063 <xsl:value-of select=
"$colspecs/ancestor::tgroup/@align"/>
1068 <xsl:if test=
"$colspec/@char">
1069 <xsl:attribute name=
"char">
1070 <xsl:value-of select=
"$colspec/@char"/>
1073 <xsl:if test=
"$colspec/@charoff">
1074 <xsl:attribute name=
"charoff">
1075 <xsl:value-of select=
"$colspec/@charoff"/>
1081 <xsl:call-template name=
"generate.col">
1082 <xsl:with-param name=
"countcol" select=
"$countcol"/>
1083 <xsl:with-param name=
"colspecs" select=
"$colspecs"/>
1084 <xsl:with-param name=
"count" select=
"$count+1"/>
1085 <xsl:with-param name=
"colnum">
1087 <xsl:when test=
"$colspec/@colnum">
1088 <xsl:value-of select=
"$colspec/@colnum + 1"/>
1091 <xsl:value-of select=
"$colnum + 1"/>
1095 </xsl:call-template>
1102 <xsl:template name=
"colspec.colwidth">
1103 <!-- when this macro is called, the current context must be an entry -->
1104 <xsl:param name=
"colname"></xsl:param>
1105 <!-- .. = row, ../.. = thead|tbody, ../../.. = tgroup -->
1106 <xsl:param name=
"colspecs" select=
"../../../../tgroup/colspec"/>
1107 <xsl:param name=
"count">1</xsl:param>
1109 <xsl:when test=
"$count>count($colspecs)"></xsl:when>
1111 <xsl:variable name=
"colspec" select=
"$colspecs[$count=position()]"/>
1113 <xsl:when test=
"$colspec/@colname=$colname">
1114 <xsl:value-of select=
"$colspec/@colwidth"/>
1117 <xsl:call-template name=
"colspec.colwidth">
1118 <xsl:with-param name=
"colname" select=
"$colname"/>
1119 <xsl:with-param name=
"colspecs" select=
"$colspecs"/>
1120 <xsl:with-param name=
"count" select=
"$count+1"/>
1121 </xsl:call-template>
1128 <!-- ====================================================================== -->
1130 <xsl:template name=
"tr.attributes">
1131 <xsl:param name=
"row" select=
"."/>
1132 <xsl:param name=
"rownum" select=
"0"/>
1134 <!-- by default, do nothing. But you might want to say:
1136 <xsl:if test="$rownum mod 2 = 0">
1137 <xsl:attribute name="class">oddrow</xsl:attribute>