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 9297 2012-04-22 03:56:16Z 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="align">
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="align">
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="id.attribute"/>
596 <xsl:call-template name="tr.attributes">
597 <xsl:with-param name="rownum">
598 <xsl:number from="tgroup" count="row"/>
602 <xsl:if test="$row-height != ''">
603 <xsl:attribute name="height">
604 <xsl:value-of select="$row-height"/>
608 <xsl:if test="$bgcolor != ''">
609 <xsl:attribute name="bgcolor">
610 <xsl:value-of select="$bgcolor"/>
614 <xsl:if test="$class != ''">
615 <xsl:attribute name="class">
616 <xsl:value-of select="$class"/>
620 <xsl:if test="$table.borders.with.css != 0">
621 <xsl:if test="@rowsep = 1 and following-sibling::row">
622 <xsl:attribute name="style">
623 <xsl:call-template name="border">
624 <xsl:with-param name="side" select="'bottom'"/>
630 <xsl:if test="@align">
631 <xsl:attribute name="align">
632 <xsl:value-of select="@align"/>
635 <xsl:if test="@char">
636 <xsl:attribute name="char">
637 <xsl:value-of select="@char"/>
640 <xsl:if test="@charoff">
641 <xsl:attribute name="charoff">
642 <xsl:value-of select="@charoff"/>
645 <xsl:if test="@valign">
646 <xsl:attribute name="valign">
647 <xsl:value-of select="@valign"/>
651 <xsl:apply-templates select="(entry|entrytbl)[1]">
652 <xsl:with-param name="spans" select="$spans"/>
653 </xsl:apply-templates>
656 <xsl:if test="$browserows = 'recurse'">
657 <xsl:if test="following-sibling::row">
658 <xsl:variable name="nextspans">
659 <xsl:apply-templates select="(entry|entrytbl)[1]" mode="span">
660 <xsl:with-param name="spans" select="$spans"/>
661 </xsl:apply-templates>
664 <xsl:apply-templates select="following-sibling::row[1]">
665 <xsl:with-param name="spans" select="$nextspans"/>
666 <xsl:with-param name="browserows" select="$browserows"/>
667 </xsl:apply-templates>
672 <xsl:template match="entry|entrytbl" name="entry">
673 <xsl:param name="col">
675 <xsl:when test="@revisionflag">
676 <xsl:number from="row"/>
678 <xsl:otherwise>1</xsl:otherwise>
682 <xsl:param name="spans"/>
684 <xsl:variable name="cellgi">
686 <xsl:when test="ancestor::thead">th</xsl:when>
687 <xsl:when test="ancestor::tfoot">th</xsl:when>
688 <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]">
689 <xsl:text>th</xsl:text>
691 <xsl:otherwise>td</xsl:otherwise>
695 <xsl:variable name="empty.cell" select="count(node()) = 0"/>
697 <xsl:variable name="named.colnum">
698 <xsl:call-template name="entry.colnum"/>
701 <xsl:variable name="entry.colnum">
703 <xsl:when test="$named.colnum > 0">
704 <xsl:value-of select="$named.colnum"/>
707 <xsl:value-of select="$col"/>
712 <xsl:variable name="entry.colspan">
714 <xsl:when test="@spanname or @namest">
715 <xsl:call-template name="calculate.colspan"/>
717 <xsl:otherwise>1</xsl:otherwise>
721 <xsl:variable name="following.spans">
722 <xsl:call-template name="calculate.following.spans">
723 <xsl:with-param name="colspan" select="$entry.colspan"/>
724 <xsl:with-param name="spans" select="$spans"/>
728 <xsl:variable name="rowsep">
730 <!-- If this is the last row, rowsep never applies. -->
731 <xsl:when test="ancestor::entrytbl and not (ancestor-or-self::row[1]/following-sibling::row) and not (ancestor::thead)">
732 <xsl:value-of select="0"/>
734 <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)">
735 <xsl:value-of select="0"/>
737 <xsl:when test="@morerows and not(@morerows < count(ancestor-or-self::row[1]/following-sibling::row))">
738 <xsl:value-of select="0"/>
741 <xsl:call-template name="inherited.table.attribute">
742 <xsl:with-param name="entry" select="."/>
743 <xsl:with-param name="colnum" select="$entry.colnum"/>
744 <xsl:with-param name="attribute" select="'rowsep'"/>
750 <xsl:variable name="colsep">
752 <!-- If this is the last column, colsep never applies. -->
753 <xsl:when test="$following.spans = ''">0</xsl:when>
755 <xsl:call-template name="inherited.table.attribute">
756 <xsl:with-param name="entry" select="."/>
757 <xsl:with-param name="colnum" select="$entry.colnum"/>
758 <xsl:with-param name="attribute" select="'colsep'"/>
764 <xsl:variable name="valign">
765 <xsl:call-template name="inherited.table.attribute">
766 <xsl:with-param name="entry" select="."/>
767 <xsl:with-param name="colnum" select="$entry.colnum"/>
768 <xsl:with-param name="attribute" select="'valign'"/>
772 <xsl:variable name="align">
773 <xsl:call-template name="inherited.table.attribute">
774 <xsl:with-param name="entry" select="."/>
775 <xsl:with-param name="colnum" select="$entry.colnum"/>
776 <xsl:with-param name="attribute" select="'align'"/>
780 <xsl:variable name="char">
781 <xsl:call-template name="inherited.table.attribute">
782 <xsl:with-param name="entry" select="."/>
783 <xsl:with-param name="colnum" select="$entry.colnum"/>
784 <xsl:with-param name="attribute" select="'char'"/>
788 <xsl:variable name="charoff">
789 <xsl:call-template name="inherited.table.attribute">
790 <xsl:with-param name="entry" select="."/>
791 <xsl:with-param name="colnum" select="$entry.colnum"/>
792 <xsl:with-param name="attribute" select="'charoff'"/>
797 <xsl:when test="$spans != '' and not(starts-with($spans,'0:'))">
798 <xsl:call-template name="entry">
799 <xsl:with-param name="col" select="$col+1"/>
800 <xsl:with-param name="spans" select="substring-after($spans,':')"/>
804 <xsl:when test="number($entry.colnum) > $col">
805 <xsl:call-template name="empty.table.cell"/>
806 <xsl:call-template name="entry">
807 <xsl:with-param name="col" select="$col+1"/>
808 <xsl:with-param name="spans" select="substring-after($spans,':')"/>
813 <xsl:variable name="bgcolor">
814 <xsl:if test="processing-instruction('dbhtml')">
815 <xsl:call-template name="pi.dbhtml_bgcolor"/>
819 <xsl:element name="{$cellgi}" namespace="http://www.w3.org/1999/xhtml">
820 <xsl:call-template name="id.attribute"/>
821 <xsl:if test="$bgcolor != ''">
822 <xsl:attribute name="bgcolor">
823 <xsl:value-of select="$bgcolor"/>
827 <xsl:call-template name="locale.html.attributes"/>
829 <xsl:when test="$entry.propagates.style != 0 and @role">
830 <xsl:apply-templates select="." mode="class.attribute">
831 <xsl:with-param name="class" select="@role"/>
832 </xsl:apply-templates>
835 <xsl:apply-templates select="." mode="class.attribute">
836 <xsl:with-param name="class" select="''"/>
837 </xsl:apply-templates>
841 <xsl:if test="$show.revisionflag and @revisionflag">
842 <xsl:attribute name="class">
843 <xsl:value-of select="@revisionflag"/>
847 <xsl:if test="$table.borders.with.css != 0">
848 <xsl:attribute name="style">
849 <xsl:if test="$colsep > 0">
850 <xsl:call-template name="border">
851 <xsl:with-param name="side" select="'right'"/>
854 <xsl:if test="$rowsep > 0">
855 <xsl:call-template name="border">
856 <xsl:with-param name="side" select="'bottom'"/>
862 <xsl:if test="@morerows > 0">
863 <xsl:attribute name="rowspan">
864 <xsl:value-of select="1+@morerows"/>
868 <xsl:if test="$entry.colspan > 1">
869 <xsl:attribute name="colspan">
870 <xsl:value-of select="$entry.colspan"/>
874 <xsl:if test="$align != ''">
875 <xsl:attribute name="align">
876 <xsl:value-of select="$align"/>
880 <xsl:if test="$valign != ''">
881 <xsl:attribute name="valign">
882 <xsl:value-of select="$valign"/>
886 <xsl:if test="$char != ''">
887 <xsl:attribute name="char">
888 <xsl:value-of select="$char"/>
892 <xsl:if test="$charoff != ''">
893 <xsl:attribute name="charoff">
894 <xsl:value-of select="$charoff"/>
898 <xsl:if test="not(preceding-sibling::*) and (ancestor::row[1]/@id or ancestor::row[1]/@xml:id)">
899 <xsl:call-template name="anchor">
900 <xsl:with-param name="node" select="ancestor::row[1]"/>
904 <xsl:call-template name="anchor"/>
907 <xsl:when test="$empty.cell">
908 <xsl:text> </xsl:text>
910 <xsl:when test="self::entrytbl">
911 <xsl:call-template name="tgroup"/>
914 <xsl:apply-templates/>
920 <xsl:when test="following-sibling::entry|following-sibling::entrytbl">
921 <xsl:apply-templates select="(following-sibling::entry |following-sibling::entrytbl)[1]">
922 <xsl:with-param name="col" select="$col+$entry.colspan"/>
923 <xsl:with-param name="spans" select="$following.spans"/>
924 </xsl:apply-templates>
927 <xsl:call-template name="finaltd">
928 <xsl:with-param name="spans" select="$following.spans"/>
929 <xsl:with-param name="col" select="$col+$entry.colspan"/>
937 <xsl:template match="entry|entrytbl" name="sentry" mode="span">
938 <xsl:param name="col" select="1"/>
939 <xsl:param name="spans"/>
941 <xsl:variable name="entry.colnum">
942 <xsl:call-template name="entry.colnum"/>
945 <xsl:variable name="entry.colspan">
947 <xsl:when test="@spanname or @namest">
948 <xsl:call-template name="calculate.colspan"/>
950 <xsl:otherwise>1</xsl:otherwise>
954 <xsl:variable name="following.spans">
955 <xsl:call-template name="calculate.following.spans">
956 <xsl:with-param name="colspan" select="$entry.colspan"/>
957 <xsl:with-param name="spans" select="$spans"/>
962 <xsl:when test="$spans != '' and not(starts-with($spans,'0:'))">
963 <xsl:value-of select="substring-before($spans,':')-1"/>
964 <xsl:text>:</xsl:text>
965 <xsl:call-template name="sentry">
966 <xsl:with-param name="col" select="$col+1"/>
967 <xsl:with-param name="spans" select="substring-after($spans,':')"/>
971 <xsl:when test="number($entry.colnum) > $col">
972 <xsl:text>0:</xsl:text>
973 <xsl:call-template name="sentry">
974 <xsl:with-param name="col" select="$col + 1"/>
975 <xsl:with-param name="spans" select="substring-after($spans,':')"/>
980 <xsl:call-template name="copy-string">
981 <xsl:with-param name="count" select="$entry.colspan"/>
982 <xsl:with-param name="string">
984 <xsl:when test="@morerows">
985 <xsl:value-of select="@morerows"/>
987 <xsl:otherwise>0</xsl:otherwise>
989 <xsl:text>:</xsl:text>
994 <xsl:when test="following-sibling::entry|following-sibling::entrytbl">
995 <xsl:apply-templates select="(following-sibling::entry |following-sibling::entrytbl)[1]" mode="span">
996 <xsl:with-param name="col" select="$col+$entry.colspan"/>
997 <xsl:with-param name="spans" select="$following.spans"/>
998 </xsl:apply-templates>
1001 <xsl:call-template name="sfinaltd">
1002 <xsl:with-param name="spans" select="$following.spans"/>
1003 </xsl:call-template>
1010 <xsl:template name="generate.colgroup">
1011 <xsl:param name="cols" select="1"/>
1012 <xsl:param name="count" select="1"/>
1014 <xsl:when test="$count > $cols"/>
1016 <xsl:call-template name="generate.col">
1017 <xsl:with-param name="countcol" select="$count"/>
1018 </xsl:call-template>
1019 <xsl:call-template name="generate.colgroup">
1020 <xsl:with-param name="cols" select="$cols"/>
1021 <xsl:with-param name="count" select="$count+1"/>
1022 </xsl:call-template>
1027 <xsl:template name="generate.col">
1028 <xsl:param name="countcol">1</xsl:param>
1029 <xsl:param name="colspecs" select="./colspec"/>
1030 <xsl:param name="count">1</xsl:param>
1031 <xsl:param name="colnum">1</xsl:param>
1034 <xsl:when test="$count>count($colspecs)">
1038 <xsl:variable name="colspec" select="$colspecs[$count=position()]"/>
1039 <xsl:variable name="colspec.colnum">
1041 <xsl:when test="$colspec/@colnum">
1042 <xsl:value-of select="$colspec/@colnum"/>
1045 <xsl:value-of select="$colnum"/>
1051 <xsl:when test="$colspec.colnum=$countcol">
1054 <xsl:when test="$colspec/@colwidth and $use.extensions != 0 and $tablecolumns.extension != 0">
1055 <xsl:attribute name="width">
1057 <xsl:when test="normalize-space($colspec/@colwidth) = '*'">
1058 <xsl:value-of select="'1*'"/>
1061 <xsl:value-of select="$colspec/@colwidth"/>
1066 <!-- pass through to HTML if no * in colspecs -->
1067 <xsl:when test="$colspec/@colwidth and not($colspec/parent::*/colspec/@colwidth[contains(.,'*')])">
1068 <xsl:attribute name="width">
1070 <xsl:when test="normalize-space($colspec/@colwidth) = '*'">
1071 <xsl:value-of select="'1*'"/>
1074 <xsl:value-of select="$colspec/@colwidth"/>
1082 <xsl:when test="$colspec/@align">
1083 <xsl:attribute name="align">
1084 <xsl:value-of select="$colspec/@align"/>
1087 <!-- Suggested by Pavel ZAMPACH <zampach@nemcb.cz> -->
1088 <xsl:when test="$colspecs/ancestor::tgroup/@align">
1089 <xsl:attribute name="align">
1090 <xsl:value-of select="$colspecs/ancestor::tgroup/@align"/>
1095 <xsl:if test="$colspec/@char">
1096 <xsl:attribute name="char">
1097 <xsl:value-of select="$colspec/@char"/>
1101 <xsl:if test="$colspec/@charoff">
1102 <xsl:attribute name="charoff">
1103 <xsl:value-of select="$colspec/@charoff"/>
1107 <xsl:if test="$colspec/@colname">
1108 <xsl:attribute name="class">
1109 <xsl:value-of select="$colspec/@colname"/>
1115 <xsl:call-template name="generate.col">
1116 <xsl:with-param name="countcol" select="$countcol"/>
1117 <xsl:with-param name="colspecs" select="$colspecs"/>
1118 <xsl:with-param name="count" select="$count+1"/>
1119 <xsl:with-param name="colnum">
1121 <xsl:when test="$colspec/@colnum">
1122 <xsl:value-of select="$colspec/@colnum + 1"/>
1125 <xsl:value-of select="$colnum + 1"/>
1129 </xsl:call-template>
1136 <xsl:template name="colspec.colwidth">
1137 <!-- when this macro is called, the current context must be an entry -->
1138 <xsl:param name="colname"/>
1139 <!-- .. = row, ../.. = thead|tbody, ../../.. = tgroup -->
1140 <xsl:param name="colspecs" select="../../../../tgroup/colspec"/>
1141 <xsl:param name="count">1</xsl:param>
1143 <xsl:when test="$count>count($colspecs)"/>
1145 <xsl:variable name="colspec" select="$colspecs[$count=position()]"/>
1147 <xsl:when test="$colspec/@colname=$colname">
1148 <xsl:value-of select="$colspec/@colwidth"/>
1151 <xsl:call-template name="colspec.colwidth">
1152 <xsl:with-param name="colname" select="$colname"/>
1153 <xsl:with-param name="colspecs" select="$colspecs"/>
1154 <xsl:with-param name="count" select="$count+1"/>
1155 </xsl:call-template>
1162 <!-- ====================================================================== -->
1164 <xsl:template name="tr.attributes">
1165 <xsl:param name="row" select="."/>
1166 <xsl:param name="rownum" select="0"/>
1168 <!-- by default, do nothing. But you might want to say:
1170 <xsl:if test="$rownum mod 2 = 0">
1171 <xsl:attribute name="class">oddrow</xsl:attribute>