1 <?xml version="1.0" encoding="ASCII"?><!--This file was created automatically by html2xhtml--><!--from the HTML stylesheets.--><xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:d="http://docbook.org/ns/docbook" 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 d" version="1.0">
3 <xsl:include href="../common/table.xsl"/>
5 <!-- ********************************************************************
7 This file is part of the XSL DocBook Stylesheet distribution.
8 See ../README or http://cdn.docbook.org/release/xsl/current/ for
9 copyright and other information.
11 ******************************************************************** -->
13 <lxslt:component prefix="xtbl" functions="adjustColumnWidths"/>
15 <xsl:template name="empty.table.cell">
16 <xsl:param name="colnum" select="0"/>
18 <xsl:variable name="rowsep">
20 <!-- If this is the last row, rowsep never applies. -->
21 <xsl:when test="not(ancestor-or-self::d:row[1]/following-sibling::d:row or ancestor-or-self::d:thead/following-sibling::d:tbody or ancestor-or-self::d:tbody/preceding-sibling::d:tfoot)">
22 <xsl:value-of select="0"/>
25 <xsl:call-template name="inherited.table.attribute">
26 <xsl:with-param name="entry" select="NOT-AN-ELEMENT-NAME"/>
27 <xsl:with-param name="row" select="ancestor-or-self::d:row[1]"/>
28 <xsl:with-param name="colnum" select="$colnum"/>
29 <xsl:with-param name="attribute" select="'rowsep'"/>
35 <xsl:variable name="colsep">
37 <!-- If this is the last column, colsep never applies. -->
38 <xsl:when test="number($colnum) >= ancestor::d:tgroup/@cols">0</xsl:when>
40 <xsl:call-template name="inherited.table.attribute">
41 <xsl:with-param name="entry" select="NOT-AN-ELEMENT-NAME"/>
42 <xsl:with-param name="row" select="ancestor-or-self::d:row[1]"/>
43 <xsl:with-param name="colnum" select="$colnum"/>
44 <xsl:with-param name="attribute" select="'colsep'"/>
50 <td class="auto-generated">
51 <xsl:if test="$table.borders.with.css != 0">
52 <xsl:attribute name="style">
53 <xsl:if test="$colsep > 0">
54 <xsl:call-template name="border">
55 <xsl:with-param name="side" select="'right'"/>
58 <xsl:if test="$rowsep > 0">
59 <xsl:call-template name="border">
60 <xsl:with-param name="side" select="'bottom'"/>
65 <xsl:text> </xsl:text>
69 <!-- ==================================================================== -->
71 <xsl:template name="border">
72 <xsl:param name="side" select="'left'"/>
73 <xsl:param name="padding" select="0"/>
74 <xsl:param name="style" select="$table.cell.border.style"/>
75 <xsl:param name="color" select="$table.cell.border.color"/>
76 <xsl:param name="thickness" select="$table.cell.border.thickness"/>
78 <!-- Note: Some browsers (mozilla) require at least a width and style. -->
81 <xsl:when test="($thickness != '' and $style != '' and $color != '') or ($thickness != '' and $style != '') or ($thickness != '')">
82 <!-- use the compound property if we can: -->
83 <!-- it saves space and probably works more reliably -->
84 <xsl:text>border-</xsl:text>
85 <xsl:value-of select="$side"/>
86 <xsl:text>: </xsl:text>
87 <xsl:value-of select="$thickness"/>
88 <xsl:text> </xsl:text>
89 <xsl:value-of select="$style"/>
90 <xsl:text> </xsl:text>
91 <xsl:value-of select="$color"/>
92 <xsl:text>; </xsl:text>
95 <!-- we need to specify the styles individually -->
96 <xsl:if test="$thickness != ''">
97 <xsl:text>border-</xsl:text>
98 <xsl:value-of select="$side"/>
99 <xsl:text>-width: </xsl:text>
100 <xsl:value-of select="$thickness"/>
101 <xsl:text>; </xsl:text>
104 <xsl:if test="$style != ''">
105 <xsl:text>border-</xsl:text>
106 <xsl:value-of select="$side"/>
107 <xsl:text>-style: </xsl:text>
108 <xsl:value-of select="$style"/>
109 <xsl:text>; </xsl:text>
112 <xsl:if test="$color != ''">
113 <xsl:text>border-</xsl:text>
114 <xsl:value-of select="$side"/>
115 <xsl:text>-color: </xsl:text>
116 <xsl:value-of select="$color"/>
117 <xsl:text>; </xsl:text>
123 <!-- ==================================================================== -->
125 <xsl:template match="d:tgroup" name="tgroup">
126 <xsl:if test="not(@cols) or @cols = '' or string(number(@cols)) = 'NaN'">
127 <xsl:message terminate="yes">
128 <xsl:text>Error: CALS tables must specify the number of columns.</xsl:text>
132 <xsl:variable name="summary">
133 <xsl:call-template name="pi.dbhtml_table-summary"/>
136 <xsl:variable name="cellspacing">
137 <xsl:call-template name="pi.dbhtml_cellspacing"/>
140 <xsl:variable name="cellpadding">
141 <xsl:call-template name="pi.dbhtml_cellpadding"/>
145 <!-- common attributes should come from parent table, not tgroup -->
146 <xsl:apply-templates select=".." mode="common.html.attributes"/>
149 <!-- If there's a textobject/phrase for the table summary, use it -->
150 <xsl:when test="../d:textobject/d:phrase">
151 <xsl:attribute name="summary">
152 <xsl:value-of select="../d:textobject/d:phrase"/>
156 <!-- If there's a <?dbhtml table-summary="foo"?> PI, use it for
157 the HTML table summary attribute -->
158 <xsl:when test="$summary != ''">
159 <xsl:attribute name="summary">
160 <xsl:value-of select="$summary"/>
164 <!-- Otherwise, if there's a title, use that -->
165 <xsl:when test="../d:title">
166 <xsl:attribute name="summary">
167 <!-- This screws up on inline markup and footnotes, oh well... -->
168 <xsl:value-of select="string(../d:title)"/>
172 <!-- Otherwise, forget the whole idea -->
173 <xsl:otherwise><!-- nevermind --></xsl:otherwise>
176 <xsl:if test="$cellspacing != '' or $html.cellspacing != ''">
177 <xsl:attribute name="cellspacing">
179 <xsl:when test="$cellspacing != ''">
180 <xsl:value-of select="$cellspacing"/>
183 <xsl:value-of select="$html.cellspacing"/>
189 <xsl:if test="$cellpadding != '' or $html.cellpadding != ''">
190 <xsl:attribute name="cellpadding">
192 <xsl:when test="$cellpadding != ''">
193 <xsl:value-of select="$cellpadding"/>
196 <xsl:value-of select="$html.cellpadding"/>
202 <xsl:if test="../@pgwide=1 or local-name(.) = 'entrytbl'">
203 <xsl:attribute name="width">100%</xsl:attribute>
207 <xsl:when test="$table.borders.with.css != 0">
209 <xsl:when test="../@frame='all' or (not(../@frame) and $default.table.frame='all')">
210 <xsl:attribute name="style">
211 <xsl:text>border-collapse: collapse;</xsl:text>
212 <xsl:call-template name="border">
213 <xsl:with-param name="side" select="'top'"/>
214 <xsl:with-param name="style" select="$table.frame.border.style"/>
215 <xsl:with-param name="color" select="$table.frame.border.color"/>
216 <xsl:with-param name="thickness" select="$table.frame.border.thickness"/>
218 <xsl:call-template name="border">
219 <xsl:with-param name="side" select="'bottom'"/>
220 <xsl:with-param name="style" select="$table.frame.border.style"/>
221 <xsl:with-param name="color" select="$table.frame.border.color"/>
222 <xsl:with-param name="thickness" select="$table.frame.border.thickness"/>
224 <xsl:call-template name="border">
225 <xsl:with-param name="side" select="'left'"/>
226 <xsl:with-param name="style" select="$table.frame.border.style"/>
227 <xsl:with-param name="color" select="$table.frame.border.color"/>
228 <xsl:with-param name="thickness" select="$table.frame.border.thickness"/>
230 <xsl:call-template name="border">
231 <xsl:with-param name="side" select="'right'"/>
232 <xsl:with-param name="style" select="$table.frame.border.style"/>
233 <xsl:with-param name="color" select="$table.frame.border.color"/>
234 <xsl:with-param name="thickness" select="$table.frame.border.thickness"/>
238 <xsl:when test="../@frame='topbot' or (not(../@frame) and $default.table.frame='topbot')">
239 <xsl:attribute name="style">
240 <xsl:text>border-collapse: collapse;</xsl:text>
241 <xsl:call-template name="border">
242 <xsl:with-param name="side" select="'top'"/>
243 <xsl:with-param name="style" select="$table.frame.border.style"/>
244 <xsl:with-param name="color" select="$table.frame.border.color"/>
245 <xsl:with-param name="thickness" select="$table.frame.border.thickness"/>
247 <xsl:call-template name="border">
248 <xsl:with-param name="side" select="'bottom'"/>
249 <xsl:with-param name="style" select="$table.frame.border.style"/>
250 <xsl:with-param name="color" select="$table.frame.border.color"/>
251 <xsl:with-param name="thickness" select="$table.frame.border.thickness"/>
255 <xsl:when test="../@frame='top' or (not(../@frame) and $default.table.frame='top')">
256 <xsl:attribute name="style">
257 <xsl:text>border-collapse: collapse;</xsl:text>
258 <xsl:call-template name="border">
259 <xsl:with-param name="side" select="'top'"/>
260 <xsl:with-param name="style" select="$table.frame.border.style"/>
261 <xsl:with-param name="color" select="$table.frame.border.color"/>
262 <xsl:with-param name="thickness" select="$table.frame.border.thickness"/>
266 <xsl:when test="../@frame='bottom' or (not(../@frame) and $default.table.frame='bottom')">
267 <xsl:attribute name="style">
268 <xsl:text>border-collapse: collapse;</xsl:text>
269 <xsl:call-template name="border">
270 <xsl:with-param name="side" select="'bottom'"/>
271 <xsl:with-param name="style" select="$table.frame.border.style"/>
272 <xsl:with-param name="color" select="$table.frame.border.color"/>
273 <xsl:with-param name="thickness" select="$table.frame.border.thickness"/>
277 <xsl:when test="../@frame='sides' or (not(../@frame) and $default.table.frame='sides')">
278 <xsl:attribute name="style">
279 <xsl:text>border-collapse: collapse;</xsl:text>
280 <xsl:call-template name="border">
281 <xsl:with-param name="side" select="'left'"/>
282 <xsl:with-param name="style" select="$table.frame.border.style"/>
283 <xsl:with-param name="color" select="$table.frame.border.color"/>
284 <xsl:with-param name="thickness" select="$table.frame.border.thickness"/>
286 <xsl:call-template name="border">
287 <xsl:with-param name="side" select="'right'"/>
288 <xsl:with-param name="style" select="$table.frame.border.style"/>
289 <xsl:with-param name="color" select="$table.frame.border.color"/>
290 <xsl:with-param name="thickness" select="$table.frame.border.thickness"/>
294 <xsl:when test="../@frame='none'">
295 <xsl:attribute name="style">
296 <xsl:text>border: none;</xsl:text>
300 <xsl:attribute name="style">
301 <xsl:text>border-collapse: collapse;</xsl:text>
307 <xsl:when test="../@frame='none' or (not(../@frame) and $default.table.frame='none') or local-name(.) = 'entrytbl'">
308 <xsl:attribute name="border">0</xsl:attribute>
311 <xsl:attribute name="border">1</xsl:attribute>
315 <xsl:variable name="colgroup">
317 <xsl:call-template name="generate.colgroup">
318 <xsl:with-param name="cols" select="@cols"/>
323 <xsl:variable name="explicit.table.width">
324 <xsl:call-template name="pi.dbhtml_table-width">
325 <xsl:with-param name="node" select=".."/>
329 <xsl:variable name="table.width">
331 <xsl:when test="$explicit.table.width != ''">
332 <xsl:value-of select="$explicit.table.width"/>
334 <xsl:when test="$default.table.width = ''">
335 <xsl:text>100%</xsl:text>
338 <xsl:value-of select="$default.table.width"/>
343 <xsl:if test="$default.table.width != '' or $explicit.table.width != ''">
344 <xsl:attribute name="width">
346 <xsl:when test="contains($table.width, '%')">
347 <xsl:value-of select="$table.width"/>
349 <xsl:when test="$use.extensions != 0 and $tablecolumns.extension != 0">
351 <xsl:when test="function-available('stbl:convertLength')">
352 <xsl:value-of select="stbl:convertLength($table.width)"/>
354 <xsl:when test="function-available('xtbl:convertLength')">
355 <xsl:value-of select="xtbl:convertLength($table.width)"/>
358 <xsl:message terminate="yes">
359 <xsl:text>No convertLength function available.</xsl:text>
365 <xsl:value-of select="$table.width"/>
372 <xsl:when test="$use.extensions != 0 and $tablecolumns.extension != 0">
374 <xsl:when test="function-available('stbl:adjustColumnWidths')">
375 <xsl:copy-of select="stbl:adjustColumnWidths($colgroup)"/>
377 <xsl:when test="function-available('xtbl:adjustColumnWidths')">
378 <xsl:copy-of select="xtbl:adjustColumnWidths($colgroup)"/>
380 <xsl:when test="function-available('ptbl:adjustColumnWidths')">
381 <xsl:copy-of select="ptbl:adjustColumnWidths($colgroup)"/>
384 <xsl:message terminate="yes">
385 <xsl:text>No adjustColumnWidths function available.</xsl:text>
391 <xsl:copy-of select="$colgroup"/>
395 <xsl:apply-templates select="d:thead"/>
396 <xsl:apply-templates select="d:tfoot"/>
397 <xsl:apply-templates select="d:tbody"/>
399 <xsl:if test=".//d:footnote|../d:title//d:footnote">
400 <tbody class="footnotes">
402 <td colspan="{@cols}">
403 <xsl:apply-templates select=".//d:footnote|../d:title//d:footnote" mode="table.footnote.mode"/>
411 <xsl:template match="d:tgroup/processing-instruction('dbhtml')">
412 <xsl:variable name="summary">
413 <xsl:call-template name="pi.dbhtml_table-summary"/>
416 <!-- Suppress the table-summary PI -->
417 <xsl:if test="$summary = ''">
418 <xsl:processing-instruction name="dbhtml">
419 <xsl:value-of select="."/>
420 </xsl:processing-instruction>
424 <xsl:template match="d:colspec"/>
426 <xsl:template match="d:spanspec"/>
428 <xsl:template match="d:thead|d:tfoot">
429 <xsl:element name="{local-name(.)}" namespace="http://www.w3.org/1999/xhtml">
430 <xsl:if test="@align">
431 <xsl:attribute name="align">
432 <xsl:value-of select="@align"/>
435 <xsl:if test="@char">
436 <xsl:attribute name="char">
437 <xsl:value-of select="@char"/>
440 <xsl:if test="@charoff">
441 <xsl:attribute name="charoff">
442 <xsl:value-of select="@charoff"/>
445 <xsl:if test="@valign">
446 <xsl:attribute name="valign">
447 <xsl:value-of select="@valign"/>
452 <!-- recurse on rows only if @morerows is present -->
453 <xsl:when test="d:row/d:entry/@morerows|d:row/d:entrytbl/@morerows">
454 <xsl:apply-templates select="d:row[1]">
455 <xsl:with-param name="spans">
456 <xsl:call-template name="blank.spans">
457 <xsl:with-param name="cols" select="../@cols"/>
460 <xsl:with-param name="browserows" select="'recurse'"/>
461 </xsl:apply-templates>
464 <xsl:apply-templates select="d:row">
465 <xsl:with-param name="spans">
466 <xsl:call-template name="blank.spans">
467 <xsl:with-param name="cols" select="../@cols"/>
470 <xsl:with-param name="browserows" select="'loop'"/>
471 </xsl:apply-templates>
478 <xsl:template match="d:tbody">
480 <xsl:if test="@align">
481 <xsl:attribute name="align">
482 <xsl:value-of select="@align"/>
485 <xsl:if test="@char">
486 <xsl:attribute name="char">
487 <xsl:value-of select="@char"/>
490 <xsl:if test="@charoff">
491 <xsl:attribute name="charoff">
492 <xsl:value-of select="@charoff"/>
495 <xsl:if test="@valign">
496 <xsl:attribute name="valign">
497 <xsl:value-of select="@valign"/>
502 <xsl:when test="d:row/d:entry/@morerows|d:row/d:entrytbl/@morerows">
503 <xsl:apply-templates select="d:row[1]">
504 <xsl:with-param name="spans">
505 <xsl:call-template name="blank.spans">
506 <xsl:with-param name="cols" select="../@cols"/>
509 <xsl:with-param name="browserows" select="'recurse'"/>
510 </xsl:apply-templates>
513 <xsl:apply-templates select="d:row">
514 <xsl:with-param name="spans">
515 <xsl:call-template name="blank.spans">
516 <xsl:with-param name="cols" select="../@cols"/>
519 <xsl:with-param name="browserows" select="'loop'"/>
520 </xsl:apply-templates>
527 <xsl:template match="d:row">
528 <xsl:param name="spans"/>
529 <xsl:param name="browserows"/>
532 <xsl:when test="contains($spans, '0')">
533 <xsl:call-template name="normal-row">
534 <xsl:with-param name="spans" select="$spans"/>
535 <xsl:with-param name="browserows" select="$browserows"/>
541 <xsl:text>Ignoring row: </xsl:text>
542 <xsl:value-of select="$spans"/>
543 <xsl:text> = </xsl:text>
544 <xsl:call-template name="consume-row">
545 <xsl:with-param name="spans" select="$spans"/>
550 <xsl:if test="normalize-space(.//text()) != ''">
551 <xsl:message>Warning: overlapped row contains content!</xsl:message>
554 <tr><xsl:comment> This row intentionally left blank </xsl:comment></tr>
556 <xsl:if test="$browserows = 'recurse'">
557 <xsl:apply-templates select="following-sibling::d:row[1]">
558 <xsl:with-param name="spans">
559 <xsl:call-template name="consume-row">
560 <xsl:with-param name="spans" select="$spans"/>
563 <xsl:with-param name="browserows" select="$browserows"/>
564 </xsl:apply-templates>
570 <xsl:template name="normal-row">
571 <xsl:param name="spans"/>
572 <xsl:param name="browserows"/>
574 <xsl:variable name="row-height">
575 <xsl:if test="processing-instruction('dbhtml')">
576 <xsl:call-template name="pi.dbhtml_row-height"/>
580 <xsl:variable name="bgcolor">
581 <xsl:if test="processing-instruction('dbhtml')">
582 <xsl:call-template name="pi.dbhtml_bgcolor"/>
586 <xsl:variable name="class">
587 <xsl:if test="processing-instruction('dbhtml')">
588 <xsl:call-template name="pi.dbhtml_class"/>
593 <xsl:call-template name="id.attribute"/>
594 <xsl:call-template name="tr.attributes">
595 <xsl:with-param name="rownum">
596 <xsl:number from="d:tgroup" count="d: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::d: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="(d:entry|d:entrytbl)[1]">
650 <xsl:with-param name="spans" select="$spans"/>
651 </xsl:apply-templates>
654 <xsl:if test="$browserows = 'recurse'">
655 <xsl:if test="following-sibling::d:row">
656 <xsl:variable name="nextspans">
657 <xsl:apply-templates select="(d:entry|d:entrytbl)[1]" mode="span">
658 <xsl:with-param name="spans" select="$spans"/>
659 </xsl:apply-templates>
662 <xsl:apply-templates select="following-sibling::d:row[1]">
663 <xsl:with-param name="spans" select="$nextspans"/>
664 <xsl:with-param name="browserows" select="$browserows"/>
665 </xsl:apply-templates>
670 <xsl:template match="d:entry|d:entrytbl" name="entry">
671 <xsl:param name="col">
673 <xsl:when test="@revisionflag">
674 <xsl:number from="d:row"/>
676 <xsl:otherwise>1</xsl:otherwise>
680 <xsl:param name="spans"/>
682 <xsl:variable name="empty.cell" select="count(node()) = 0"/>
684 <xsl:variable name="named.colnum">
685 <xsl:call-template name="entry.colnum"/>
688 <xsl:variable name="entry.colnum">
690 <xsl:when test="$named.colnum > 0">
691 <xsl:value-of select="$named.colnum"/>
694 <xsl:value-of select="$col"/>
699 <xsl:variable name="entry.colspan">
701 <xsl:when test="@spanname or @namest">
702 <xsl:call-template name="calculate.colspan"/>
704 <xsl:otherwise>1</xsl:otherwise>
708 <xsl:variable name="following.spans">
709 <xsl:call-template name="calculate.following.spans">
710 <xsl:with-param name="colspan" select="$entry.colspan"/>
711 <xsl:with-param name="spans" select="$spans"/>
715 <xsl:variable name="cellgi">
717 <xsl:when test="ancestor::d:thead">th</xsl:when>
718 <xsl:when test="ancestor::d:tfoot">th</xsl:when>
719 <xsl:when test="ancestor::d:tbody and (ancestor::d:table[@rowheader = 'firstcol'] or ancestor::d:informaltable[@rowheader = 'firstcol']) and $entry.colnum = 1">
720 <xsl:text>th</xsl:text>
722 <xsl:otherwise>td</xsl:otherwise>
726 <xsl:variable name="rowsep">
728 <!-- If this is the last row, rowsep never applies. -->
729 <xsl:when test="ancestor::d:entrytbl and not (ancestor-or-self::d:row[1]/following-sibling::d:row) and not (ancestor::d:thead)">
730 <xsl:value-of select="0"/>
732 <xsl:when test="not(ancestor-or-self::d:row[1]/following-sibling::d:row or ancestor-or-self::d:thead/following-sibling::d:tbody or ancestor-or-self::d:tbody/preceding-sibling::d:tfoot)">
733 <xsl:value-of select="0"/>
735 <!-- not last row with @morerows (thead is not last row) -->
736 <xsl:when test="not(ancestor::d:thead) and @morerows and not(@morerows < count(ancestor-or-self::d:row[1]/following-sibling::d: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:call-template name="id.attribute"/>
820 <xsl:if test="$bgcolor != ''">
821 <xsl:attribute name="bgcolor">
822 <xsl:value-of select="$bgcolor"/>
826 <xsl:call-template name="locale.html.attributes"/>
828 <xsl:when test="$entry.propagates.style != 0 and @role">
829 <xsl:apply-templates select="." mode="class.attribute">
830 <xsl:with-param name="class" select="@role"/>
831 </xsl:apply-templates>
834 <xsl:apply-templates select="." mode="class.attribute">
835 <xsl:with-param name="class" select="''"/>
836 </xsl:apply-templates>
840 <xsl:if test="$show.revisionflag and @revisionflag">
841 <xsl:attribute name="class">
842 <xsl:value-of select="@revisionflag"/>
846 <xsl:if test="$table.borders.with.css != 0">
847 <xsl:attribute name="style">
848 <xsl:if test="$colsep > 0">
849 <xsl:call-template name="border">
850 <xsl:with-param name="side" select="'right'"/>
853 <xsl:if test="$rowsep > 0">
854 <xsl:call-template name="border">
855 <xsl:with-param name="side" select="'bottom'"/>
861 <xsl:if test="@morerows > 0">
862 <xsl:attribute name="rowspan">
863 <xsl:value-of select="1+@morerows"/>
867 <xsl:if test="$entry.colspan > 1">
868 <xsl:attribute name="colspan">
869 <xsl:value-of select="$entry.colspan"/>
873 <xsl:if test="$align != ''">
874 <xsl:attribute name="align">
875 <xsl:value-of select="$align"/>
879 <xsl:if test="$valign != ''">
880 <xsl:attribute name="valign">
881 <xsl:value-of select="$valign"/>
885 <xsl:if test="$char != ''">
886 <xsl:attribute name="char">
887 <xsl:value-of select="$char"/>
891 <xsl:if test="$charoff != ''">
892 <xsl:attribute name="charoff">
893 <xsl:value-of select="$charoff"/>
897 <xsl:if test="not(preceding-sibling::*) and (ancestor::d:row[1]/@id or ancestor::d:row[1]/@xml:id)">
898 <xsl:call-template name="anchor">
899 <xsl:with-param name="node" select="ancestor::d:row[1]"/>
903 <xsl:call-template name="anchor"/>
906 <xsl:when test="$empty.cell">
907 <xsl:text> </xsl:text>
909 <xsl:when test="self::d:entrytbl">
910 <xsl:call-template name="tgroup"/>
913 <xsl:apply-templates/>
919 <xsl:when test="following-sibling::d:entry|following-sibling::d:entrytbl">
920 <xsl:apply-templates select="(following-sibling::d:entry |following-sibling::d:entrytbl)[1]">
921 <xsl:with-param name="col" select="$col+$entry.colspan"/>
922 <xsl:with-param name="spans" select="$following.spans"/>
923 </xsl:apply-templates>
926 <xsl:call-template name="finaltd">
927 <xsl:with-param name="spans" select="$following.spans"/>
928 <xsl:with-param name="col" select="$col+$entry.colspan"/>
936 <xsl:template match="d:entry|d:entrytbl" name="sentry" mode="span">
937 <xsl:param name="col" select="1"/>
938 <xsl:param name="spans"/>
940 <xsl:variable name="entry.colnum">
941 <xsl:call-template name="entry.colnum"/>
944 <xsl:variable name="entry.colspan">
946 <xsl:when test="@spanname or @namest">
947 <xsl:call-template name="calculate.colspan"/>
949 <xsl:otherwise>1</xsl:otherwise>
953 <xsl:variable name="following.spans">
954 <xsl:call-template name="calculate.following.spans">
955 <xsl:with-param name="colspan" select="$entry.colspan"/>
956 <xsl:with-param name="spans" select="$spans"/>
961 <xsl:when test="$spans != '' and not(starts-with($spans,'0:'))">
962 <xsl:value-of select="substring-before($spans,':')-1"/>
963 <xsl:text>:</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,':')"/>
970 <xsl:when test="number($entry.colnum) > $col">
971 <xsl:text>0:</xsl:text>
972 <xsl:call-template name="sentry">
973 <xsl:with-param name="col" select="$col + 1"/>
974 <xsl:with-param name="spans" select="substring-after($spans,':')"/>
979 <xsl:call-template name="copy-string">
980 <xsl:with-param name="count" select="$entry.colspan"/>
981 <xsl:with-param name="string">
983 <xsl:when test="@morerows">
984 <xsl:value-of select="@morerows"/>
986 <xsl:otherwise>0</xsl:otherwise>
988 <xsl:text>:</xsl:text>
993 <xsl:when test="following-sibling::d:entry|following-sibling::d:entrytbl">
994 <xsl:apply-templates select="(following-sibling::d:entry |following-sibling::d:entrytbl)[1]" mode="span">
995 <xsl:with-param name="col" select="$col+$entry.colspan"/>
996 <xsl:with-param name="spans" select="$following.spans"/>
997 </xsl:apply-templates>
1000 <xsl:call-template name="sfinaltd">
1001 <xsl:with-param name="spans" select="$following.spans"/>
1002 </xsl:call-template>
1009 <xsl:template name="generate.colgroup">
1010 <xsl:param name="cols" select="1"/>
1011 <xsl:param name="count" select="1"/>
1013 <xsl:when test="$count > $cols"/>
1015 <xsl:call-template name="generate.col">
1016 <xsl:with-param name="countcol" select="$count"/>
1017 </xsl:call-template>
1018 <xsl:call-template name="generate.colgroup">
1019 <xsl:with-param name="cols" select="$cols"/>
1020 <xsl:with-param name="count" select="$count+1"/>
1021 </xsl:call-template>
1026 <xsl:template name="generate.col">
1027 <xsl:param name="countcol">1</xsl:param>
1028 <xsl:param name="colspecs" select="./d:colspec"/>
1029 <xsl:param name="count">1</xsl:param>
1030 <xsl:param name="colnum">1</xsl:param>
1033 <xsl:when test="$count>count($colspecs)">
1037 <xsl:variable name="colspec" select="$colspecs[$count=position()]"/>
1038 <xsl:variable name="colspec.colnum">
1040 <xsl:when test="$colspec/@colnum">
1041 <xsl:value-of select="$colspec/@colnum"/>
1044 <xsl:value-of select="$colnum"/>
1050 <xsl:when test="$colspec.colnum=$countcol">
1053 <xsl:when test="$colspec/@colwidth and $use.extensions != 0 and $tablecolumns.extension != 0">
1054 <xsl:attribute name="width">
1056 <xsl:when test="normalize-space($colspec/@colwidth) = '*'">
1057 <xsl:value-of select="'1*'"/>
1060 <xsl:value-of select="$colspec/@colwidth"/>
1065 <!-- pass through to HTML if no * in colspecs -->
1066 <xsl:when test="$colspec/@colwidth and not($colspec/parent::*/d:colspec/@colwidth[contains(.,'*')])">
1067 <xsl:attribute name="width">
1069 <xsl:when test="normalize-space($colspec/@colwidth) = '*'">
1070 <xsl:value-of select="'1*'"/>
1073 <xsl:value-of select="$colspec/@colwidth"/>
1081 <xsl:when test="$colspec/@align">
1082 <xsl:attribute name="align">
1083 <xsl:value-of select="$colspec/@align"/>
1086 <!-- Suggested by Pavel ZAMPACH <zampach@nemcb.cz> -->
1087 <xsl:when test="$colspecs/ancestor::d:tgroup/@align">
1088 <xsl:attribute name="align">
1089 <xsl:value-of select="$colspecs/ancestor::d:tgroup/@align"/>
1094 <xsl:if test="$colspec/@char">
1095 <xsl:attribute name="char">
1096 <xsl:value-of select="$colspec/@char"/>
1100 <xsl:if test="$colspec/@charoff">
1101 <xsl:attribute name="charoff">
1102 <xsl:value-of select="$colspec/@charoff"/>
1106 <xsl:if test="$colspec/@colname">
1107 <xsl:attribute name="class">
1108 <xsl:value-of select="$colspec/@colname"/>
1114 <xsl:call-template name="generate.col">
1115 <xsl:with-param name="countcol" select="$countcol"/>
1116 <xsl:with-param name="colspecs" select="$colspecs"/>
1117 <xsl:with-param name="count" select="$count+1"/>
1118 <xsl:with-param name="colnum">
1120 <xsl:when test="$colspec/@colnum">
1121 <xsl:value-of select="$colspec/@colnum + 1"/>
1124 <xsl:value-of select="$colnum + 1"/>
1128 </xsl:call-template>
1135 <xsl:template name="colspec.colwidth">
1136 <!-- when this macro is called, the current context must be an entry -->
1137 <xsl:param name="colname"/>
1138 <!-- .. = row, ../.. = thead|tbody, ../../.. = tgroup -->
1139 <xsl:param name="colspecs" select="../../../../d:tgroup/d:colspec"/>
1140 <xsl:param name="count">1</xsl:param>
1142 <xsl:when test="$count>count($colspecs)"/>
1144 <xsl:variable name="colspec" select="$colspecs[$count=position()]"/>
1146 <xsl:when test="$colspec/@colname=$colname">
1147 <xsl:value-of select="$colspec/@colwidth"/>
1150 <xsl:call-template name="colspec.colwidth">
1151 <xsl:with-param name="colname" select="$colname"/>
1152 <xsl:with-param name="colspecs" select="$colspecs"/>
1153 <xsl:with-param name="count" select="$count+1"/>
1154 </xsl:call-template>
1161 <!-- ====================================================================== -->
1163 <xsl:template name="tr.attributes">
1164 <xsl:param name="row" select="."/>
1165 <xsl:param name="rownum" select="0"/>
1167 <!-- by default, do nothing. But you might want to say:
1169 <xsl:if test="$rownum mod 2 = 0">
1170 <xsl:attribute name="class">oddrow</xsl:attribute>