1 <?xml version="1.0" encoding="ASCII"?>
2 <!--This file was created automatically by html2xhtml-->
3 <!--from the HTML stylesheets.-->
4 <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:doc="http://nwalsh.com/xsl/documentation/1.0" xmlns:stbl="http://nwalsh.com/xslt/ext/com.nwalsh.saxon.Table" xmlns:xtbl="xalan://com.nwalsh.xalan.Table" xmlns:lxslt="http://xml.apache.org/xslt" xmlns:ptbl="http://nwalsh.com/xslt/ext/xsltproc/python/Table" xmlns="http://www.w3.org/1999/xhtml" exclude-result-prefixes="doc stbl xtbl lxslt ptbl" version="1.0">
6 <xsl:include href="../common/table.xsl"/>
8 <!-- ********************************************************************
9 $Id: table.xsl 8813 2010-08-09 21:18:23Z bobstayton $
10 ********************************************************************
12 This file is part of the XSL DocBook Stylesheet distribution.
13 See ../README or http://docbook.sf.net/release/xsl/current/ for
14 copyright and other information.
16 ******************************************************************** -->
18 <lxslt:component prefix="xtbl" functions="adjustColumnWidths"/>
20 <xsl:template name="empty.table.cell">
21 <xsl:param name="colnum" select="0"/>
23 <xsl:variable name="rowsep">
25 <!-- If this is the last row, rowsep never applies. -->
26 <xsl:when test="not(ancestor-or-self::row[1]/following-sibling::row or ancestor-or-self::thead/following-sibling::tbody or ancestor-or-self::tbody/preceding-sibling::tfoot)">
27 <xsl:value-of select="0"/>
30 <xsl:call-template name="inherited.table.attribute">
31 <xsl:with-param name="entry" select="NOT-AN-ELEMENT-NAME"/>
32 <xsl:with-param name="row" select="ancestor-or-self::row[1]"/>
33 <xsl:with-param name="colnum" select="$colnum"/>
34 <xsl:with-param name="attribute" select="'rowsep'"/>
40 <xsl:variable name="colsep">
42 <!-- If this is the last column, colsep never applies. -->
43 <xsl:when test="number($colnum) >= ancestor::tgroup/@cols">0</xsl:when>
45 <xsl:call-template name="inherited.table.attribute">
46 <xsl:with-param name="entry" select="NOT-AN-ELEMENT-NAME"/>
47 <xsl:with-param name="row" select="ancestor-or-self::row[1]"/>
48 <xsl:with-param name="colnum" select="$colnum"/>
49 <xsl:with-param name="attribute" select="'colsep'"/>
55 <td class="auto-generated">
56 <xsl:if test="$table.borders.with.css != 0">
57 <xsl:attribute name="style">
58 <xsl:if test="$colsep > 0">
59 <xsl:call-template name="border">
60 <xsl:with-param name="side" select="'right'"/>
63 <xsl:if test="$rowsep > 0">
64 <xsl:call-template name="border">
65 <xsl:with-param name="side" select="'bottom'"/>
70 <xsl:text> </xsl:text>
74 <!-- ==================================================================== -->
76 <xsl:template name="border">
77 <xsl:param name="side" select="'left'"/>
78 <xsl:param name="padding" select="0"/>
79 <xsl:param name="style" select="$table.cell.border.style"/>
80 <xsl:param name="color" select="$table.cell.border.color"/>
81 <xsl:param name="thickness" select="$table.cell.border.thickness"/>
83 <!-- Note: Some browsers (mozilla) require at least a width and style. -->
86 <xsl:when test="($thickness != '' and $style != '' and $color != '') or ($thickness != '' and $style != '') or ($thickness != '')">
87 <!-- use the compound property if we can: -->
88 <!-- it saves space and probably works more reliably -->
89 <xsl:text>border-</xsl:text>
90 <xsl:value-of select="$side"/>
91 <xsl:text>: </xsl:text>
92 <xsl:value-of select="$thickness"/>
93 <xsl:text> </xsl:text>
94 <xsl:value-of select="$style"/>
95 <xsl:text> </xsl:text>
96 <xsl:value-of select="$color"/>
97 <xsl:text>; </xsl:text>
100 <!-- we need to specify the styles individually -->
101 <xsl:if test="$thickness != ''">
102 <xsl:text>border-</xsl:text>
103 <xsl:value-of select="$side"/>
104 <xsl:text>-width: </xsl:text>
105 <xsl:value-of select="$thickness"/>
106 <xsl:text>; </xsl:text>
109 <xsl:if test="$style != ''">
110 <xsl:text>border-</xsl:text>
111 <xsl:value-of select="$side"/>
112 <xsl:text>-style: </xsl:text>
113 <xsl:value-of select="$style"/>
114 <xsl:text>; </xsl:text>
117 <xsl:if test="$color != ''">
118 <xsl:text>border-</xsl:text>
119 <xsl:value-of select="$side"/>
120 <xsl:text>-color: </xsl:text>
121 <xsl:value-of select="$color"/>
122 <xsl:text>; </xsl:text>
128 <!-- ==================================================================== -->
130 <xsl:template match="tgroup" name="tgroup">
131 <xsl:if test="not(@cols) or @cols = '' or string(number(@cols)) = 'NaN'">
132 <xsl:message terminate="yes">
133 <xsl:text>Error: CALS tables must specify the number of columns.</xsl:text>
137 <xsl:variable name="summary">
138 <xsl:call-template name="pi.dbhtml_table-summary"/>
141 <xsl:variable name="cellspacing">
142 <xsl:call-template name="pi.dbhtml_cellspacing"/>
145 <xsl:variable name="cellpadding">
146 <xsl:call-template name="pi.dbhtml_cellpadding"/>
151 <!-- If there's a textobject/phrase for the table summary, use it -->
152 <xsl:when test="../textobject/phrase">
153 <xsl:attribute name="summary">
154 <xsl:value-of select="../textobject/phrase"/>
158 <!-- If there's a <?dbhtml table-summary="foo"?> PI, use it for
159 the HTML table summary attribute -->
160 <xsl:when test="$summary != ''">
161 <xsl:attribute name="summary">
162 <xsl:value-of select="$summary"/>
166 <!-- Otherwise, if there's a title, use that -->
167 <xsl:when test="../title">
168 <xsl:attribute name="summary">
169 <!-- This screws up on inline markup and footnotes, oh well... -->
170 <xsl:value-of select="string(../title)"/>
174 <!-- Otherwise, forget the whole idea -->
175 <xsl:otherwise><!-- nevermind --></xsl:otherwise>
178 <xsl:if test="$cellspacing != '' or $html.cellspacing != ''">
179 <xsl:attribute name="cellspacing">
181 <xsl:when test="$cellspacing != ''">
182 <xsl:value-of select="$cellspacing"/>
185 <xsl:value-of select="$html.cellspacing"/>
191 <xsl:if test="$cellpadding != '' or $html.cellpadding != ''">
192 <xsl:attribute name="cellpadding">
194 <xsl:when test="$cellpadding != ''">
195 <xsl:value-of select="$cellpadding"/>
198 <xsl:value-of select="$html.cellpadding"/>
204 <xsl:if test="../@pgwide=1 or local-name(.) = 'entrytbl'">
205 <xsl:attribute name="width">100%</xsl:attribute>
209 <xsl:when test="$table.borders.with.css != 0">
211 <xsl:when test="../@frame='all' or (not(../@frame) and $default.table.frame='all')">
212 <xsl:attribute name="style">
213 <xsl:text>border-collapse: collapse;</xsl:text>
214 <xsl:call-template name="border">
215 <xsl:with-param name="side" select="'top'"/>
216 <xsl:with-param name="style" select="$table.frame.border.style"/>
217 <xsl:with-param name="color" select="$table.frame.border.color"/>
218 <xsl:with-param name="thickness" select="$table.frame.border.thickness"/>
220 <xsl:call-template name="border">
221 <xsl:with-param name="side" select="'bottom'"/>
222 <xsl:with-param name="style" select="$table.frame.border.style"/>
223 <xsl:with-param name="color" select="$table.frame.border.color"/>
224 <xsl:with-param name="thickness" select="$table.frame.border.thickness"/>
226 <xsl:call-template name="border">
227 <xsl:with-param name="side" select="'left'"/>
228 <xsl:with-param name="style" select="$table.frame.border.style"/>
229 <xsl:with-param name="color" select="$table.frame.border.color"/>
230 <xsl:with-param name="thickness" select="$table.frame.border.thickness"/>
232 <xsl:call-template name="border">
233 <xsl:with-param name="side" select="'right'"/>
234 <xsl:with-param name="style" select="$table.frame.border.style"/>
235 <xsl:with-param name="color" select="$table.frame.border.color"/>
236 <xsl:with-param name="thickness" select="$table.frame.border.thickness"/>
240 <xsl:when test="../@frame='topbot' or (not(../@frame) and $default.table.frame='topbot')">
241 <xsl:attribute name="style">
242 <xsl:text>border-collapse: collapse;</xsl:text>
243 <xsl:call-template name="border">
244 <xsl:with-param name="side" select="'top'"/>
245 <xsl:with-param name="style" select="$table.frame.border.style"/>
246 <xsl:with-param name="color" select="$table.frame.border.color"/>
247 <xsl:with-param name="thickness" select="$table.frame.border.thickness"/>
249 <xsl:call-template name="border">
250 <xsl:with-param name="side" select="'bottom'"/>
251 <xsl:with-param name="style" select="$table.frame.border.style"/>
252 <xsl:with-param name="color" select="$table.frame.border.color"/>
253 <xsl:with-param name="thickness" select="$table.frame.border.thickness"/>
257 <xsl:when test="../@frame='top' or (not(../@frame) and $default.table.frame='top')">
258 <xsl:attribute name="style">
259 <xsl:text>border-collapse: collapse;</xsl:text>
260 <xsl:call-template name="border">
261 <xsl:with-param name="side" select="'top'"/>
262 <xsl:with-param name="style" select="$table.frame.border.style"/>
263 <xsl:with-param name="color" select="$table.frame.border.color"/>
264 <xsl:with-param name="thickness" select="$table.frame.border.thickness"/>
268 <xsl:when test="../@frame='bottom' or (not(../@frame) and $default.table.frame='bottom')">
269 <xsl:attribute name="style">
270 <xsl:text>border-collapse: collapse;</xsl:text>
271 <xsl:call-template name="border">
272 <xsl:with-param name="side" select="'bottom'"/>
273 <xsl:with-param name="style" select="$table.frame.border.style"/>
274 <xsl:with-param name="color" select="$table.frame.border.color"/>
275 <xsl:with-param name="thickness" select="$table.frame.border.thickness"/>
279 <xsl:when test="../@frame='sides' or (not(../@frame) and $default.table.frame='sides')">
280 <xsl:attribute name="style">
281 <xsl:text>border-collapse: collapse;</xsl:text>
282 <xsl:call-template name="border">
283 <xsl:with-param name="side" select="'left'"/>
284 <xsl:with-param name="style" select="$table.frame.border.style"/>
285 <xsl:with-param name="color" select="$table.frame.border.color"/>
286 <xsl:with-param name="thickness" select="$table.frame.border.thickness"/>
288 <xsl:call-template name="border">
289 <xsl:with-param name="side" select="'right'"/>
290 <xsl:with-param name="style" select="$table.frame.border.style"/>
291 <xsl:with-param name="color" select="$table.frame.border.color"/>
292 <xsl:with-param name="thickness" select="$table.frame.border.thickness"/>
296 <xsl:when test="../@frame='none'">
297 <xsl:attribute name="style">
298 <xsl:text>border: none;</xsl:text>
302 <xsl:attribute name="style">
303 <xsl:text>border-collapse: collapse;</xsl:text>
309 <xsl:when test="../@frame='none' or (not(../@frame) and $default.table.frame='none') or local-name(.) = 'entrytbl'">
310 <xsl:attribute name="border">0</xsl:attribute>
313 <xsl:attribute name="border">1</xsl:attribute>
317 <xsl:variable name="colgroup">
319 <xsl:call-template name="generate.colgroup">
320 <xsl:with-param name="cols" select="@cols"/>
325 <xsl:variable name="explicit.table.width">
326 <xsl:call-template name="pi.dbhtml_table-width">
327 <xsl:with-param name="node" select=".."/>
331 <xsl:variable name="table.width">
333 <xsl:when test="$explicit.table.width != ''">
334 <xsl:value-of select="$explicit.table.width"/>
336 <xsl:when test="$default.table.width = ''">
337 <xsl:text>100%</xsl:text>
340 <xsl:value-of select="$default.table.width"/>
345 <xsl:if test="$default.table.width != '' or $explicit.table.width != ''">
346 <xsl:attribute name="width">
348 <xsl:when test="contains($table.width, '%')">
349 <xsl:value-of select="$table.width"/>
351 <xsl:when test="$use.extensions != 0 and $tablecolumns.extension != 0">
353 <xsl:when test="function-available('stbl:convertLength')">
354 <xsl:value-of select="stbl:convertLength($table.width)"/>
356 <xsl:when test="function-available('xtbl:convertLength')">
357 <xsl:value-of select="xtbl:convertLength($table.width)"/>
360 <xsl:message terminate="yes">
361 <xsl:text>No convertLength function available.</xsl:text>
367 <xsl:value-of select="$table.width"/>
374 <xsl:when test="$use.extensions != 0 and $tablecolumns.extension != 0">
376 <xsl:when test="function-available('stbl:adjustColumnWidths')">
377 <xsl:copy-of select="stbl:adjustColumnWidths($colgroup)"/>
379 <xsl:when test="function-available('xtbl:adjustColumnWidths')">
380 <xsl:copy-of select="xtbl:adjustColumnWidths($colgroup)"/>
382 <xsl:when test="function-available('ptbl:adjustColumnWidths')">
383 <xsl:copy-of select="ptbl:adjustColumnWidths($colgroup)"/>
386 <xsl:message terminate="yes">
387 <xsl:text>No adjustColumnWidths function available.</xsl:text>
393 <xsl:copy-of select="$colgroup"/>
397 <xsl:apply-templates select="thead"/>
398 <xsl:apply-templates select="tfoot"/>
399 <xsl:apply-templates select="tbody"/>
401 <xsl:if test=".//footnote|../title//footnote">
402 <tbody class="footnotes">
404 <td colspan="{@cols}">
405 <xsl:apply-templates select=".//footnote|../title//footnote" mode="table.footnote.mode"/>
413 <xsl:template match="tgroup/processing-instruction('dbhtml')">
414 <xsl:variable name="summary">
415 <xsl:call-template name="pi.dbhtml_table-summary"/>
418 <!-- Suppress the table-summary PI -->
419 <xsl:if test="$summary = ''">
420 <xsl:processing-instruction name="dbhtml">
421 <xsl:value-of select="."/>
422 </xsl:processing-instruction>
426 <xsl:template match="colspec"/>
428 <xsl:template match="spanspec"/>
430 <xsl:template match="thead|tfoot">
431 <xsl:element name="{local-name(.)}" namespace="http://www.w3.org/1999/xhtml">
432 <xsl:if test="@align">
433 <xsl:attribute name="style"><xsl:text>text-align: </xsl:text>
434 <xsl:value-of select="@align"/>
437 <xsl:if test="@char">
438 <xsl:attribute name="char">
439 <xsl:value-of select="@char"/>
442 <xsl:if test="@charoff">
443 <xsl:attribute name="charoff">
444 <xsl:value-of select="@charoff"/>
447 <xsl:if test="@valign">
448 <xsl:attribute name="valign">
449 <xsl:value-of select="@valign"/>
454 <!-- recurse on rows only if @morerows is present -->
455 <xsl:when test="row/entry/@morerows|row/entrytbl/@morerows">
456 <xsl:apply-templates select="row[1]">
457 <xsl:with-param name="spans">
458 <xsl:call-template name="blank.spans">
459 <xsl:with-param name="cols" select="../@cols"/>
462 <xsl:with-param name="browserows" select="'recurse'"/>
463 </xsl:apply-templates>
466 <xsl:apply-templates select="row">
467 <xsl:with-param name="spans">
468 <xsl:call-template name="blank.spans">
469 <xsl:with-param name="cols" select="../@cols"/>
472 <xsl:with-param name="browserows" select="'loop'"/>
473 </xsl:apply-templates>
480 <xsl:template match="tbody">
482 <xsl:if test="@align">
483 <xsl:attribute name="style"><xsl:text>text-align: </xsl:text>
484 <xsl:value-of select="@align"/>
487 <xsl:if test="@char">
488 <xsl:attribute name="char">
489 <xsl:value-of select="@char"/>
492 <xsl:if test="@charoff">
493 <xsl:attribute name="charoff">
494 <xsl:value-of select="@charoff"/>
497 <xsl:if test="@valign">
498 <xsl:attribute name="valign">
499 <xsl:value-of select="@valign"/>
504 <xsl:when test="row/entry/@morerows|row/entrytbl/@morerows">
505 <xsl:apply-templates select="row[1]">
506 <xsl:with-param name="spans">
507 <xsl:call-template name="blank.spans">
508 <xsl:with-param name="cols" select="../@cols"/>
511 <xsl:with-param name="browserows" select="'recurse'"/>
512 </xsl:apply-templates>
515 <xsl:apply-templates select="row">
516 <xsl:with-param name="spans">
517 <xsl:call-template name="blank.spans">
518 <xsl:with-param name="cols" select="../@cols"/>
521 <xsl:with-param name="browserows" select="'loop'"/>
522 </xsl:apply-templates>
529 <xsl:template match="row">
530 <xsl:param name="spans"/>
531 <xsl:param name="browserows"/>
534 <xsl:when test="contains($spans, '0')">
535 <xsl:call-template name="normal-row">
536 <xsl:with-param name="spans" select="$spans"/>
537 <xsl:with-param name="browserows" select="$browserows"/>
543 <xsl:text>Ignoring row: </xsl:text>
544 <xsl:value-of select="$spans"/>
545 <xsl:text> = </xsl:text>
546 <xsl:call-template name="consume-row">
547 <xsl:with-param name="spans" select="$spans"/>
552 <xsl:if test="normalize-space(.//text()) != ''">
553 <xsl:message>Warning: overlapped row contains content!</xsl:message>
556 <tr><xsl:comment> This row intentionally left blank </xsl:comment></tr>
558 <xsl:if test="$browserows = 'recurse'">
559 <xsl:apply-templates select="following-sibling::row[1]">
560 <xsl:with-param name="spans">
561 <xsl:call-template name="consume-row">
562 <xsl:with-param name="spans" select="$spans"/>
565 <xsl:with-param name="browserows" select="$browserows"/>
566 </xsl:apply-templates>
572 <xsl:template name="normal-row">
573 <xsl:param name="spans"/>
574 <xsl:param name="browserows"/>
576 <xsl:variable name="row-height">
577 <xsl:if test="processing-instruction('dbhtml')">
578 <xsl:call-template name="pi.dbhtml_row-height"/>
582 <xsl:variable name="bgcolor">
583 <xsl:if test="processing-instruction('dbhtml')">
584 <xsl:call-template name="pi.dbhtml_bgcolor"/>
588 <xsl:variable name="class">
589 <xsl:if test="processing-instruction('dbhtml')">
590 <xsl:call-template name="pi.dbhtml_class"/>
595 <xsl:call-template name="tr.attributes">
596 <xsl:with-param name="rownum">
597 <xsl:number from="tgroup" count="row"/>
601 <xsl:if test="$row-height != ''">
602 <xsl:attribute name="height">
603 <xsl:value-of select="$row-height"/>
607 <xsl:if test="$bgcolor != ''">
608 <xsl:attribute name="style"><xsl:text>background-color: </xsl:text>
609 <xsl:value-of select="$bgcolor"/>
613 <xsl:if test="$class != ''">
614 <xsl:attribute name="class">
615 <xsl:value-of select="$class"/>
619 <xsl:if test="$table.borders.with.css != 0">
620 <xsl:if test="@rowsep = 1 and following-sibling::row">
621 <xsl:attribute name="style">
622 <xsl:call-template name="border">
623 <xsl:with-param name="side" select="'bottom'"/>
629 <xsl:if test="@align">
630 <xsl:attribute name="style"><xsl:text>text-align: </xsl:text>
631 <xsl:value-of select="@align"/>
634 <xsl:if test="@char">
635 <xsl:attribute name="char">
636 <xsl:value-of select="@char"/>
639 <xsl:if test="@charoff">
640 <xsl:attribute name="charoff">
641 <xsl:value-of select="@charoff"/>
644 <xsl:if test="@valign">
645 <xsl:attribute name="valign">
646 <xsl:value-of select="@valign"/>
650 <xsl:apply-templates select="(entry|entrytbl)[1]">
651 <xsl:with-param name="spans" select="$spans"/>
652 </xsl:apply-templates>
655 <xsl:if test="$browserows = 'recurse'">
656 <xsl:if test="following-sibling::row">
657 <xsl:variable name="nextspans">
658 <xsl:apply-templates select="(entry|entrytbl)[1]" mode="span">
659 <xsl:with-param name="spans" select="$spans"/>
660 </xsl:apply-templates>
663 <xsl:apply-templates select="following-sibling::row[1]">
664 <xsl:with-param name="spans" select="$nextspans"/>
665 <xsl:with-param name="browserows" select="$browserows"/>
666 </xsl:apply-templates>
671 <xsl:template match="entry|entrytbl" name="entry">
672 <xsl:param name="col">
674 <xsl:when test="@revisionflag">
675 <xsl:number from="row"/>
677 <xsl:otherwise>1</xsl:otherwise>
681 <xsl:param name="spans"/>
683 <xsl:variable name="cellgi">
685 <xsl:when test="ancestor::thead">th</xsl:when>
686 <xsl:when test="ancestor::tfoot">th</xsl:when>
687 <xsl:when test="ancestor::tbody and (ancestor::table[@rowheader = 'firstcol'] or ancestor::informaltable[@rowheader = 'firstcol']) and ancestor-or-self::entry[1][count(preceding-sibling::entry) = 0]">
688 <xsl:text>th</xsl:text>
690 <xsl:otherwise>td</xsl:otherwise>
694 <xsl:variable name="empty.cell" select="count(node()) = 0"/>
696 <xsl:variable name="named.colnum">
697 <xsl:call-template name="entry.colnum"/>
700 <xsl:variable name="entry.colnum">
702 <xsl:when test="$named.colnum > 0">
703 <xsl:value-of select="$named.colnum"/>
706 <xsl:value-of select="$col"/>
711 <xsl:variable name="entry.colspan">
713 <xsl:when test="@spanname or @namest">
714 <xsl:call-template name="calculate.colspan"/>
716 <xsl:otherwise>1</xsl:otherwise>
720 <xsl:variable name="following.spans">
721 <xsl:call-template name="calculate.following.spans">
722 <xsl:with-param name="colspan" select="$entry.colspan"/>
723 <xsl:with-param name="spans" select="$spans"/>
727 <xsl:variable name="rowsep">
729 <!-- If this is the last row, rowsep never applies. -->
730 <xsl:when test="ancestor::entrytbl and not (ancestor-or-self::row[1]/following-sibling::row) and not (ancestor::thead)">
731 <xsl:value-of select="0"/>
733 <xsl:when test="not(ancestor-or-self::row[1]/following-sibling::row or ancestor-or-self::thead/following-sibling::tbody or ancestor-or-self::tbody/preceding-sibling::tfoot)">
734 <xsl:value-of select="0"/>
736 <xsl:when test="@morerows and not(@morerows < count(ancestor-or-self::row[1]/following-sibling::row))">
737 <xsl:value-of select="0"/>
740 <xsl:call-template name="inherited.table.attribute">
741 <xsl:with-param name="entry" select="."/>
742 <xsl:with-param name="colnum" select="$entry.colnum"/>
743 <xsl:with-param name="attribute" select="'rowsep'"/>
749 <xsl:variable name="colsep">
751 <!-- If this is the last column, colsep never applies. -->
752 <xsl:when test="$following.spans = ''">0</xsl:when>
754 <xsl:call-template name="inherited.table.attribute">
755 <xsl:with-param name="entry" select="."/>
756 <xsl:with-param name="colnum" select="$entry.colnum"/>
757 <xsl:with-param name="attribute" select="'colsep'"/>
763 <xsl:variable name="valign">
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="'valign'"/>
771 <xsl:variable name="align">
772 <xsl:call-template name="inherited.table.attribute">
773 <xsl:with-param name="entry" select="."/>
774 <xsl:with-param name="colnum" select="$entry.colnum"/>
775 <xsl:with-param name="attribute" select="'align'"/>
779 <xsl:variable name="char">
780 <xsl:call-template name="inherited.table.attribute">
781 <xsl:with-param name="entry" select="."/>
782 <xsl:with-param name="colnum" select="$entry.colnum"/>
783 <xsl:with-param name="attribute" select="'char'"/>
787 <xsl:variable name="charoff">
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="'charoff'"/>
796 <xsl:when test="$spans != '' and not(starts-with($spans,'0:'))">
797 <xsl:call-template name="entry">
798 <xsl:with-param name="col" select="$col+1"/>
799 <xsl:with-param name="spans" select="substring-after($spans,':')"/>
803 <xsl:when test="number($entry.colnum) > $col">
804 <xsl:call-template name="empty.table.cell"/>
805 <xsl:call-template name="entry">
806 <xsl:with-param name="col" select="$col+1"/>
807 <xsl:with-param name="spans" select="substring-after($spans,':')"/>
812 <xsl:variable name="bgcolor">
813 <xsl:if test="processing-instruction('dbhtml')">
814 <xsl:call-template name="pi.dbhtml_bgcolor"/>
818 <xsl:element name="{$cellgi}" namespace="http://www.w3.org/1999/xhtml">
819 <xsl:if test="$bgcolor != ''">
820 <xsl:attribute name="style"><xsl:text>background-color: </xsl:text>
821 <xsl:value-of select="$bgcolor"/>
825 <xsl:call-template name="locale.html.attributes"/>
826 <xsl:if test="$entry.propagates.style != 0 and @role">
827 <xsl:apply-templates select="." mode="class.attribute">
828 <xsl:with-param name="class" select="@role"/>
829 </xsl:apply-templates>
832 <xsl:if test="$show.revisionflag and @revisionflag">
833 <xsl:attribute name="class">
834 <xsl:value-of select="@revisionflag"/>
838 <xsl:if test="$table.borders.with.css != 0">
839 <xsl:attribute name="style">
840 <xsl:if test="$colsep > 0">
841 <xsl:call-template name="border">
842 <xsl:with-param name="side" select="'right'"/>
845 <xsl:if test="$rowsep > 0">
846 <xsl:call-template name="border">
847 <xsl:with-param name="side" select="'bottom'"/>
853 <xsl:if test="@morerows > 0">
854 <xsl:attribute name="rowspan">
855 <xsl:value-of select="1+@morerows"/>
859 <xsl:if test="$entry.colspan > 1">
860 <xsl:attribute name="colspan">
861 <xsl:value-of select="$entry.colspan"/>
865 <xsl:if test="$align != ''">
866 <xsl:attribute name="style"><xsl:text>text-align: </xsl:text>
867 <xsl:value-of select="$align"/>
871 <xsl:if test="$valign != ''">
872 <xsl:attribute name="valign">
873 <xsl:value-of select="$valign"/>
877 <xsl:if test="$char != ''">
878 <xsl:attribute name="char">
879 <xsl:value-of select="$char"/>
883 <xsl:if test="$charoff != ''">
884 <xsl:attribute name="charoff">
885 <xsl:value-of select="$charoff"/>
889 <xsl:if test="not(preceding-sibling::*) and (ancestor::row[1]/@id or ancestor::row[1]/@xml:id)">
890 <xsl:call-template name="anchor">
891 <xsl:with-param name="node" select="ancestor::row[1]"/>
895 <xsl:call-template name="anchor"/>
898 <xsl:when test="$empty.cell">
899 <xsl:text> </xsl:text>
901 <xsl:when test="self::entrytbl">
902 <xsl:call-template name="tgroup"/>
905 <xsl:apply-templates/>
911 <xsl:when test="following-sibling::entry|following-sibling::entrytbl">
912 <xsl:apply-templates select="(following-sibling::entry |following-sibling::entrytbl)[1]">
913 <xsl:with-param name="col" select="$col+$entry.colspan"/>
914 <xsl:with-param name="spans" select="$following.spans"/>
915 </xsl:apply-templates>
918 <xsl:call-template name="finaltd">
919 <xsl:with-param name="spans" select="$following.spans"/>
920 <xsl:with-param name="col" select="$col+$entry.colspan"/>
928 <xsl:template match="entry|entrytbl" name="sentry" mode="span">
929 <xsl:param name="col" select="1"/>
930 <xsl:param name="spans"/>
932 <xsl:variable name="entry.colnum">
933 <xsl:call-template name="entry.colnum"/>
936 <xsl:variable name="entry.colspan">
938 <xsl:when test="@spanname or @namest">
939 <xsl:call-template name="calculate.colspan"/>
941 <xsl:otherwise>1</xsl:otherwise>
945 <xsl:variable name="following.spans">
946 <xsl:call-template name="calculate.following.spans">
947 <xsl:with-param name="colspan" select="$entry.colspan"/>
948 <xsl:with-param name="spans" select="$spans"/>
953 <xsl:when test="$spans != '' and not(starts-with($spans,'0:'))">
954 <xsl:value-of select="substring-before($spans,':')-1"/>
955 <xsl:text>:</xsl:text>
956 <xsl:call-template name="sentry">
957 <xsl:with-param name="col" select="$col+1"/>
958 <xsl:with-param name="spans" select="substring-after($spans,':')"/>
962 <xsl:when test="number($entry.colnum) > $col">
963 <xsl:text>0:</xsl:text>
964 <xsl:call-template name="sentry">
965 <xsl:with-param name="col" select="$col + 1"/>
966 <xsl:with-param name="spans" select="substring-after($spans,':')"/>
971 <xsl:call-template name="copy-string">
972 <xsl:with-param name="count" select="$entry.colspan"/>
973 <xsl:with-param name="string">
975 <xsl:when test="@morerows">
976 <xsl:value-of select="@morerows"/>
978 <xsl:otherwise>0</xsl:otherwise>
980 <xsl:text>:</xsl:text>
985 <xsl:when test="following-sibling::entry|following-sibling::entrytbl">
986 <xsl:apply-templates select="(following-sibling::entry |following-sibling::entrytbl)[1]" mode="span">
987 <xsl:with-param name="col" select="$col+$entry.colspan"/>
988 <xsl:with-param name="spans" select="$following.spans"/>
989 </xsl:apply-templates>
992 <xsl:call-template name="sfinaltd">
993 <xsl:with-param name="spans" select="$following.spans"/>
1001 <xsl:template name="generate.colgroup">
1002 <xsl:param name="cols" select="1"/>
1003 <xsl:param name="count" select="1"/>
1005 <xsl:when test="$count > $cols"/>
1007 <xsl:call-template name="generate.col">
1008 <xsl:with-param name="countcol" select="$count"/>
1009 </xsl:call-template>
1010 <xsl:call-template name="generate.colgroup">
1011 <xsl:with-param name="cols" select="$cols"/>
1012 <xsl:with-param name="count" select="$count+1"/>
1013 </xsl:call-template>
1018 <xsl:template name="generate.col">
1019 <xsl:param name="countcol">1</xsl:param>
1020 <xsl:param name="colspecs" select="./colspec"/>
1021 <xsl:param name="count">1</xsl:param>
1022 <xsl:param name="colnum">1</xsl:param>
1025 <xsl:when test="$count>count($colspecs)">
1029 <xsl:variable name="colspec" select="$colspecs[$count=position()]"/>
1030 <xsl:variable name="colspec.colnum">
1032 <xsl:when test="$colspec/@colnum">
1033 <xsl:value-of select="$colspec/@colnum"/>
1036 <xsl:value-of select="$colnum"/>
1042 <xsl:when test="$colspec.colnum=$countcol">
1045 <xsl:when test="$colspec/@colwidth and $use.extensions != 0 and $tablecolumns.extension != 0">
1046 <xsl:attribute name="width">
1048 <xsl:when test="normalize-space($colspec/@colwidth) = '*'">
1049 <xsl:value-of select="'1*'"/>
1052 <xsl:value-of select="$colspec/@colwidth"/>
1057 <!-- pass through to HTML if no * in colspecs -->
1058 <xsl:when test="$colspec/@colwidth and not($colspec/parent::*/colspec/@colwidth[contains(.,'*')])">
1059 <xsl:attribute name="width">
1061 <xsl:when test="normalize-space($colspec/@colwidth) = '*'">
1062 <xsl:value-of select="'1*'"/>
1065 <xsl:value-of select="$colspec/@colwidth"/>
1073 <xsl:when test="$colspec/@align">
1074 <xsl:attribute name="style"><xsl:text>text-align: </xsl:text>
1075 <xsl:value-of select="$colspec/@align"/>
1078 <!-- Suggested by Pavel ZAMPACH <zampach@nemcb.cz> -->
1079 <xsl:when test="$colspecs/ancestor::tgroup/@align">
1080 <xsl:attribute name="style"><xsl:text>text-align: </xsl:text>
1081 <xsl:value-of select="$colspecs/ancestor::tgroup/@align"/>
1086 <xsl:if test="$colspec/@char">
1087 <xsl:attribute name="char">
1088 <xsl:value-of select="$colspec/@char"/>
1092 <xsl:if test="$colspec/@charoff">
1093 <xsl:attribute name="charoff">
1094 <xsl:value-of select="$colspec/@charoff"/>
1098 <xsl:if test="$colspec/@colname">
1099 <xsl:attribute name="class">
1100 <xsl:value-of select="$colspec/@colname"/>
1106 <xsl:call-template name="generate.col">
1107 <xsl:with-param name="countcol" select="$countcol"/>
1108 <xsl:with-param name="colspecs" select="$colspecs"/>
1109 <xsl:with-param name="count" select="$count+1"/>
1110 <xsl:with-param name="colnum">
1112 <xsl:when test="$colspec/@colnum">
1113 <xsl:value-of select="$colspec/@colnum + 1"/>
1116 <xsl:value-of select="$colnum + 1"/>
1120 </xsl:call-template>
1127 <xsl:template name="colspec.colwidth">
1128 <!-- when this macro is called, the current context must be an entry -->
1129 <xsl:param name="colname"/>
1130 <!-- .. = row, ../.. = thead|tbody, ../../.. = tgroup -->
1131 <xsl:param name="colspecs" select="../../../../tgroup/colspec"/>
1132 <xsl:param name="count">1</xsl:param>
1134 <xsl:when test="$count>count($colspecs)"/>
1136 <xsl:variable name="colspec" select="$colspecs[$count=position()]"/>
1138 <xsl:when test="$colspec/@colname=$colname">
1139 <xsl:value-of select="$colspec/@colwidth"/>
1142 <xsl:call-template name="colspec.colwidth">
1143 <xsl:with-param name="colname" select="$colname"/>
1144 <xsl:with-param name="colspecs" select="$colspecs"/>
1145 <xsl:with-param name="count" select="$count+1"/>
1146 </xsl:call-template>
1153 <!-- ====================================================================== -->
1155 <xsl:template name="tr.attributes">
1156 <xsl:param name="row" select="."/>
1157 <xsl:param name="rownum" select="0"/>
1159 <!-- by default, do nothing. But you might want to say:
1161 <xsl:if test="$rownum mod 2 = 0">
1162 <xsl:attribute name="class">oddrow</xsl:attribute>