2 <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
3 xmlns:d="http://docbook.org/ns/docbook"
4 xmlns:doc="http://nwalsh.com/xsl/documentation/1.0"
5 xmlns:fo="http://www.w3.org/1999/XSL/Format"
6 xmlns:rx="http://www.renderx.com/XSL/Extensions"
7 xmlns:stbl="http://nwalsh.com/xslt/ext/com.nwalsh.saxon.Table"
8 xmlns:xtbl="com.nwalsh.xalan.Table"
9 xmlns:lxslt="http://xml.apache.org/xslt"
10 xmlns:ptbl="http://nwalsh.com/xslt/ext/xsltproc/python/Table"
11 exclude-result-prefixes="doc stbl xtbl lxslt ptbl d"
14 <xsl:include href="../common/table.xsl"/>
16 <!-- ********************************************************************
18 This file is part of the XSL DocBook Stylesheet distribution.
19 See ../README or http://cdn.docbook.org/release/xsl/current/ for
20 copyright and other information.
22 ******************************************************************** -->
24 <doc:reference xmlns="" xml:id="table-templates">
27 <title>Formatting Object Table Reference</title>
28 <releaseinfo role="meta">
31 <partintro xml:id="partintro">
32 <title>Introduction</title>
33 <para>This is technical reference documentation for the FO
34 table-processing templates in the DocBook XSL Stylesheets.</para>
35 <para>This is not intended to be user documentation. It is
36 provided for developers writing customization layers for the
41 <!-- ==================================================================== -->
43 <lxslt:component prefix="xtbl"
44 functions="adjustColumnWidths"/>
46 <!-- ==================================================================== -->
48 <xsl:template name="make.table.content">
50 <xsl:when test="d:tgroup|d:mediaobject|d:graphic">
51 <xsl:call-template name="calsTable"/>
54 <xsl:apply-templates select="." mode="htmlTable"/>
59 <!-- ==================================================================== -->
61 <xsl:template name="calsTable">
63 <xsl:variable name="keep.together">
64 <xsl:call-template name="pi.dbfo_keep-together"/>
67 <xsl:for-each select="d:tgroup">
69 <fo:table xsl:use-attribute-sets="table.table.properties">
70 <xsl:if test="$keep.together != ''">
71 <xsl:attribute name="keep-together.within-column">
72 <xsl:value-of select="$keep.together"/>
75 <xsl:call-template name="table.frame"/>
76 <xsl:if test="following-sibling::d:tgroup">
77 <xsl:attribute name="border-bottom-width">0pt</xsl:attribute>
78 <xsl:attribute name="border-bottom-style">none</xsl:attribute>
79 <xsl:attribute name="padding-bottom">0pt</xsl:attribute>
80 <xsl:attribute name="margin-bottom">0pt</xsl:attribute>
81 <xsl:attribute name="space-after">0pt</xsl:attribute>
82 <xsl:attribute name="space-after.minimum">0pt</xsl:attribute>
83 <xsl:attribute name="space-after.optimum">0pt</xsl:attribute>
84 <xsl:attribute name="space-after.maximum">0pt</xsl:attribute>
86 <xsl:if test="preceding-sibling::d:tgroup">
87 <xsl:attribute name="border-top-width">0pt</xsl:attribute>
88 <xsl:attribute name="border-top-style">none</xsl:attribute>
89 <xsl:attribute name="padding-top">0pt</xsl:attribute>
90 <xsl:attribute name="margin-top">0pt</xsl:attribute>
91 <xsl:attribute name="space-before">0pt</xsl:attribute>
92 <xsl:attribute name="space-before.minimum">0pt</xsl:attribute>
93 <xsl:attribute name="space-before.optimum">0pt</xsl:attribute>
94 <xsl:attribute name="space-before.maximum">0pt</xsl:attribute>
96 <xsl:apply-templates select="."/>
99 <xsl:for-each select="d:mediaobject|d:graphic">
100 <xsl:apply-templates select="."/>
105 <xsl:apply-templates select="d:caption"/>
109 <!-- ==================================================================== -->
111 <!-- Placeholder template enables wrapping a fo:table in
112 another table for purposes of layout or applying
113 extensions such as XEP table-omit-initial-header to
114 create "continued" titles on page breaks. -->
115 <xsl:template name="table.layout">
116 <xsl:param name="table.content" select="NOTANODE"/>
118 <xsl:copy-of select="$table.content"/>
121 <xsl:template name="table.block">
122 <xsl:param name="table.layout" select="NOTANODE"/>
124 <xsl:variable name="id">
125 <xsl:call-template name="object.id"/>
128 <xsl:variable name="param.placement"
129 select="substring-after(normalize-space(
130 $formal.title.placement), concat(local-name(.), ' '))"/>
132 <xsl:variable name="placement">
134 <xsl:when test="contains($param.placement, ' ')">
135 <xsl:value-of select="substring-before($param.placement, ' ')"/>
137 <xsl:when test="$param.placement = ''">before</xsl:when>
139 <xsl:value-of select="$param.placement"/>
144 <xsl:variable name="keep.together">
145 <xsl:call-template name="pi.dbfo_keep-together"/>
149 <xsl:when test="self::d:table">
151 xsl:use-attribute-sets="table.properties">
152 <xsl:if test="$keep.together != ''">
153 <xsl:attribute name="keep-together.within-column">
154 <xsl:value-of select="$keep.together"/>
157 <xsl:if test="$placement = 'before'">
158 <xsl:call-template name="formal.object.heading">
159 <xsl:with-param name="placement" select="$placement"/>
162 <xsl:copy-of select="$table.layout"/>
163 <xsl:call-template name="table.footnote.block"/>
164 <xsl:if test="$placement != 'before'">
165 <xsl:call-template name="formal.object.heading">
166 <xsl:with-param name="placement" select="$placement"/>
173 xsl:use-attribute-sets="informaltable.properties">
174 <xsl:if test="$keep.together != ''">
175 <xsl:attribute name="keep-together.within-column">
176 <xsl:value-of select="$keep.together"/>
179 <xsl:copy-of select="$table.layout"/>
180 <xsl:call-template name="table.footnote.block"/>
188 <!-- Output a table's footnotes in a block -->
189 <xsl:template name="table.footnote.block">
190 <xsl:if test=".//d:footnote">
191 <fo:block keep-with-previous.within-column="always">
192 <xsl:apply-templates select=".//d:footnote" mode="table.footnote.mode"/>
197 <!-- ==================================================================== -->
199 <xsl:template name="table.container">
200 <xsl:param name="table.block"/>
202 <xsl:when test="@orient='land' and
203 $fop.extensions = 0" >
204 <fo:block-container reference-orientation="90"
206 xsl:use-attribute-sets="list.block.spacing">
207 <xsl:attribute name="width">
208 <xsl:call-template name="table.width"/>
210 <fo:block start-indent="0pt" end-indent="0pt">
211 <xsl:copy-of select="$table.block"/>
213 </fo:block-container>
215 <xsl:when test="@pgwide = 1">
216 <fo:block xsl:use-attribute-sets="pgwide.properties">
217 <xsl:copy-of select="$table.block"/>
221 <xsl:copy-of select="$table.block"/>
226 <!-- ==================================================================== -->
228 <xsl:template name="empty.table.cell">
229 <xsl:param name="colnum" select="0"/>
231 <xsl:variable name="rowsep">
233 <!-- If this is the last row, rowsep never applies (except when
234 the ancestor tgroup has a following sibling tgroup) -->
235 <xsl:when test="not(ancestor-or-self::d:row[1]/following-sibling::d:row
236 or ancestor-or-self::d:thead/following-sibling::d:tbody
237 or ancestor-or-self::d:tbody/preceding-sibling::d:tfoot)
238 and not(ancestor::d:tgroup/following-sibling::d:tgroup)">
239 <xsl:value-of select="0"/>
242 <xsl:call-template name="inherited.table.attribute">
243 <xsl:with-param name="entry" select="NOT-AN-ELEMENT-NAME"/>
244 <xsl:with-param name="row" select="ancestor-or-self::d:row[1]"/>
245 <xsl:with-param name="colnum" select="$colnum"/>
246 <xsl:with-param name="attribute" select="'rowsep'"/>
252 <xsl:variable name="colsep">
254 <!-- If this is the last column, colsep never applies. -->
255 <xsl:when test="number($colnum) >= ancestor::d:tgroup/@cols">0</xsl:when>
257 <xsl:call-template name="inherited.table.attribute">
258 <xsl:with-param name="entry" select="NOT-AN-ELEMENT-NAME"/>
259 <xsl:with-param name="row" select="ancestor-or-self::d:row[1]"/>
260 <xsl:with-param name="colnum" select="$colnum"/>
261 <xsl:with-param name="attribute" select="'colsep'"/>
267 <fo:table-cell text-align="center"
268 display-align="center"
269 xsl:use-attribute-sets="table.cell.padding">
270 <xsl:if test="$xep.extensions != 0">
271 <!-- Suggested by RenderX to workaround a bug in their implementation -->
272 <xsl:attribute name="keep-together.within-column">always</xsl:attribute>
274 <xsl:if test="$rowsep > 0">
275 <xsl:call-template name="border">
276 <xsl:with-param name="side" select="'bottom'"/>
280 <xsl:if test="$colsep > 0 and number($colnum) < ancestor::d:tgroup/@cols">
281 <xsl:call-template name="border">
282 <xsl:with-param name="side" select="'end'"/>
286 <!-- fo:table-cell should not be empty -->
291 <!-- ==================================================================== -->
292 <xsl:template name="table.frame">
293 <xsl:param name="frame">
295 <xsl:when test="../@frame">
296 <xsl:value-of select="../@frame"/>
298 <xsl:when test="$default.table.frame != ''">
299 <xsl:value-of select="$default.table.frame"/>
301 <xsl:otherwise>all</xsl:otherwise>
307 <xsl:when test="$frame='all'">
308 <xsl:attribute name="border-start-style">
309 <xsl:value-of select="$table.frame.border.style"/>
311 <xsl:attribute name="border-end-style">
312 <xsl:value-of select="$table.frame.border.style"/>
314 <xsl:attribute name="border-top-style">
315 <xsl:value-of select="$table.frame.border.style"/>
317 <xsl:attribute name="border-bottom-style">
318 <xsl:value-of select="$table.frame.border.style"/>
320 <xsl:attribute name="border-start-width">
321 <xsl:value-of select="$table.frame.border.thickness"/>
323 <xsl:attribute name="border-end-width">
324 <xsl:value-of select="$table.frame.border.thickness"/>
326 <xsl:attribute name="border-top-width">
327 <xsl:value-of select="$table.frame.border.thickness"/>
329 <xsl:attribute name="border-bottom-width">
330 <xsl:value-of select="$table.frame.border.thickness"/>
332 <xsl:attribute name="border-start-color">
333 <xsl:value-of select="$table.frame.border.color"/>
335 <xsl:attribute name="border-end-color">
336 <xsl:value-of select="$table.frame.border.color"/>
338 <xsl:attribute name="border-top-color">
339 <xsl:value-of select="$table.frame.border.color"/>
341 <xsl:attribute name="border-bottom-color">
342 <xsl:value-of select="$table.frame.border.color"/>
345 <xsl:when test="$frame='bottom'">
346 <xsl:attribute name="border-start-style">none</xsl:attribute>
347 <xsl:attribute name="border-end-style">none</xsl:attribute>
348 <xsl:attribute name="border-top-style">none</xsl:attribute>
349 <xsl:attribute name="border-bottom-style">
350 <xsl:value-of select="$table.frame.border.style"/>
352 <xsl:attribute name="border-bottom-width">
353 <xsl:value-of select="$table.frame.border.thickness"/>
355 <xsl:attribute name="border-bottom-color">
356 <xsl:value-of select="$table.frame.border.color"/>
359 <xsl:when test="$frame='sides'">
360 <xsl:attribute name="border-start-style">
361 <xsl:value-of select="$table.frame.border.style"/>
363 <xsl:attribute name="border-end-style">
364 <xsl:value-of select="$table.frame.border.style"/>
366 <xsl:attribute name="border-top-style">none</xsl:attribute>
367 <xsl:attribute name="border-bottom-style">none</xsl:attribute>
368 <xsl:attribute name="border-start-width">
369 <xsl:value-of select="$table.frame.border.thickness"/>
371 <xsl:attribute name="border-end-width">
372 <xsl:value-of select="$table.frame.border.thickness"/>
374 <xsl:attribute name="border-start-color">
375 <xsl:value-of select="$table.frame.border.color"/>
377 <xsl:attribute name="border-end-color">
378 <xsl:value-of select="$table.frame.border.color"/>
381 <xsl:when test="$frame='lhs'">
382 <xsl:attribute name="border-start-style">
383 <xsl:value-of select="$table.frame.border.style"/>
385 <xsl:attribute name="border-end-style">none</xsl:attribute>
386 <xsl:attribute name="border-top-style">none</xsl:attribute>
387 <xsl:attribute name="border-bottom-style">none</xsl:attribute>
388 <xsl:attribute name="border-start-width">
389 <xsl:value-of select="$table.frame.border.thickness"/>
391 <xsl:attribute name="border-start-color">
392 <xsl:value-of select="$table.frame.border.color"/>
395 <xsl:when test="$frame='rhs'">
396 <xsl:attribute name="border-end-style">
397 <xsl:value-of select="$table.frame.border.style"/>
399 <xsl:attribute name="border-end-style">none</xsl:attribute>
400 <xsl:attribute name="border-top-style">none</xsl:attribute>
401 <xsl:attribute name="border-bottom-style">none</xsl:attribute>
402 <xsl:attribute name="border-end-width">
403 <xsl:value-of select="$table.frame.border.thickness"/>
405 <xsl:attribute name="border-end-color">
406 <xsl:value-of select="$table.frame.border.color"/>
409 <xsl:when test="$frame='top'">
410 <xsl:attribute name="border-start-style">none</xsl:attribute>
411 <xsl:attribute name="border-end-style">none</xsl:attribute>
412 <xsl:attribute name="border-top-style">
413 <xsl:value-of select="$table.frame.border.style"/>
415 <xsl:attribute name="border-bottom-style">none</xsl:attribute>
416 <xsl:attribute name="border-top-width">
417 <xsl:value-of select="$table.frame.border.thickness"/>
419 <xsl:attribute name="border-top-color">
420 <xsl:value-of select="$table.frame.border.color"/>
423 <xsl:when test="$frame='topbot'">
424 <xsl:attribute name="border-start-style">none</xsl:attribute>
425 <xsl:attribute name="border-end-style">none</xsl:attribute>
426 <xsl:attribute name="border-top-style">
427 <xsl:value-of select="$table.frame.border.style"/>
429 <xsl:attribute name="border-bottom-style">
430 <xsl:value-of select="$table.frame.border.style"/>
432 <xsl:attribute name="border-top-width">
433 <xsl:value-of select="$table.frame.border.thickness"/>
435 <xsl:attribute name="border-bottom-width">
436 <xsl:value-of select="$table.frame.border.thickness"/>
438 <xsl:attribute name="border-top-color">
439 <xsl:value-of select="$table.frame.border.color"/>
441 <xsl:attribute name="border-bottom-color">
442 <xsl:value-of select="$table.frame.border.color"/>
445 <xsl:when test="$frame='none'">
446 <xsl:attribute name="border-start-style">none</xsl:attribute>
447 <xsl:attribute name="border-end-style">none</xsl:attribute>
448 <xsl:attribute name="border-top-style">none</xsl:attribute>
449 <xsl:attribute name="border-bottom-style">none</xsl:attribute>
453 <xsl:text>Impossible frame on table: </xsl:text>
454 <xsl:value-of select="$frame"/>
456 <xsl:attribute name="border-start-style">none</xsl:attribute>
457 <xsl:attribute name="border-end-style">none</xsl:attribute>
458 <xsl:attribute name="border-top-style">none</xsl:attribute>
459 <xsl:attribute name="border-bottom-style">none</xsl:attribute>
464 <!-- ==================================================================== -->
466 <xsl:template name="border">
467 <xsl:param name="side" select="'start'"/>
469 <xsl:attribute name="border-{$side}-width">
470 <xsl:value-of select="$table.cell.border.thickness"/>
472 <xsl:attribute name="border-{$side}-style">
473 <xsl:value-of select="$table.cell.border.style"/>
475 <xsl:attribute name="border-{$side}-color">
476 <xsl:value-of select="$table.cell.border.color"/>
480 <!-- ==================================================================== -->
482 <xsl:template match="d:tgroup" name="tgroup">
483 <xsl:if test="not(@cols) or @cols = '' or string(number(@cols)) = 'NaN'">
484 <xsl:message terminate="yes">
485 <xsl:text>Error: CALS tables must specify the number of columns.</xsl:text>
489 <xsl:variable name="table.width">
490 <xsl:call-template name="table.width"/>
493 <xsl:variable name="colspecs">
495 <xsl:when test="$use.extensions != 0
496 and $tablecolumns.extension != 0">
497 <xsl:call-template name="generate.colgroup.raw">
498 <xsl:with-param name="cols" select="@cols"/>
502 <xsl:call-template name="generate.colgroup">
503 <xsl:with-param name="cols" select="@cols"/>
509 <xsl:variable name="prop-columns"
510 select=".//d:colspec[contains(@colwidth, '*')]"/>
511 <xsl:if test="count($prop-columns) != 0 or
512 $fop.extensions != 0 or
513 $fop1.extensions != 0">
514 <xsl:attribute name="table-layout">fixed</xsl:attribute>
517 <xsl:attribute name="width">
518 <xsl:value-of select="$table.width"/>
522 <xsl:when test="$use.extensions != 0
523 and $tablecolumns.extension != 0">
525 <xsl:when test="function-available('stbl:adjustColumnWidths')">
526 <xsl:copy-of select="stbl:adjustColumnWidths($colspecs)"/>
528 <xsl:when test="function-available('xtbl:adjustColumnWidths')">
529 <xsl:copy-of select="xtbl:adjustColumnWidths($colspecs)"/>
531 <xsl:when test="function-available('ptbl:adjustColumnWidths')">
532 <xsl:copy-of select="ptbl:adjustColumnWidths($colspecs)"/>
535 <xsl:message terminate="yes">
536 <xsl:text>No adjustColumnWidths function available.</xsl:text>
542 <xsl:copy-of select="$colspecs"/>
546 <xsl:apply-templates select="d:thead"/>
547 <xsl:apply-templates select="d:tfoot"/>
548 <xsl:apply-templates select="d:tbody"/>
551 <xsl:template match="d:colspec"></xsl:template>
553 <xsl:template name="table.width">
555 <xsl:variable name="numcols">
556 <xsl:call-template name="widest-html-row">
557 <xsl:with-param name="rows" select=".//d:tr"/>
561 <xsl:variable name="explicit.table.width">
563 <xsl:when test="self::d:entrytbl">
564 <xsl:call-template name="pi.dbfo_table-width"/>
566 <xsl:when test="self::d:table or self::d:informaltable">
567 <xsl:call-template name="pi.dbfo_table-width"/>
570 <!-- * no dbfo@table-width PI as a child of this table, so check -->
571 <!-- * the parent of this table to see if the table has any -->
572 <!-- * sibling dbfo@table-width PIs (FIXME: 2007-07 MikeSmith: we -->
573 <!-- * should really instead be checking here just to see if the -->
574 <!-- * first preceding sibling of this table is a -->
575 <!-- * dbfo@table-width PI) -->
576 <xsl:call-template name="pi.dbfo_table-width">
577 <xsl:with-param name="node" select=".."/>
583 <xsl:variable name="column.sum">
586 <xsl:when test="d:tgroup/@cols">
587 <!-- change context to the first tgroup -->
588 <xsl:for-each select="d:tgroup[1]">
589 <xsl:if test="count(d:colspec) = @cols">
590 <xsl:for-each select="d:colspec">
591 <xsl:if test="position() != 1">
592 <xsl:text> + </xsl:text>
595 <xsl:when test="not(@colwidth)">NOWIDTH</xsl:when>
596 <xsl:when test="contains(@colwidth, '*')">NOWIDTH</xsl:when>
598 <xsl:value-of select="@colwidth"/>
607 <xsl:if test="count(d:col|d:colgroup/d:col) = $numcols">
608 <xsl:for-each select="d:col|d:colgroup/d:col">
609 <xsl:if test="position() != 1">
610 <xsl:text> + </xsl:text>
613 <xsl:when test="not(@width)">NOWIDTH</xsl:when>
614 <xsl:when test="contains(@width, '%')">NOWIDTH</xsl:when>
616 <xsl:value-of select="@width"/>
625 <xsl:variable name="column.sum.width">
626 <xsl:if test="not(contains($column.sum, 'NOWIDTH'))">
627 <xsl:value-of select="$column.sum"/>
631 <xsl:variable name="prop-columns"
632 select=".//d:colspec[contains(@colwidth, '*')]"/>
634 <xsl:variable name="table.width">
636 <xsl:when test="$explicit.table.width != ''">
637 <xsl:value-of select="$explicit.table.width"/>
639 <xsl:when test="$column.sum.width != ''">
640 <xsl:value-of select="$column.sum.width"/>
642 <xsl:when test="$default.table.width = ''">
644 <!-- These processors don't support table-layout="auto" -->
645 <xsl:when test="$fop.extensions != 0 or
646 $fop1.extensions != 0">
647 <xsl:text>100%</xsl:text>
649 <!-- Proportional columns imply 100% width -->
650 <xsl:when test="count($prop-columns) != 0">
651 <xsl:text>100%</xsl:text>
654 <xsl:text>auto</xsl:text>
659 <xsl:value-of select="$default.table.width"/>
663 <xsl:value-of select="$table.width"/>
667 <xsl:template match="d:spanspec"></xsl:template>
669 <xsl:template match="d:thead">
670 <xsl:variable name="tgroup" select="parent::*"/>
672 <fo:table-header start-indent="0pt" end-indent="0pt">
674 <!-- Use recursion if @morerows is used -->
675 <xsl:when test="d:row/d:entry/@morerows|d:row/d:entrytbl/@morerows">
676 <xsl:apply-templates select="d:row[1]">
677 <xsl:with-param name="spans">
678 <xsl:call-template name="blank.spans">
679 <xsl:with-param name="cols" select="../@cols"/>
682 <xsl:with-param name="browserows" select="'recurse'"/>
683 </xsl:apply-templates>
686 <xsl:apply-templates select="d:row">
687 <xsl:with-param name="spans">
688 <xsl:call-template name="blank.spans">
689 <xsl:with-param name="cols" select="../@cols"/>
692 <xsl:with-param name="browserows" select="'loop'" />
693 </xsl:apply-templates>
699 <xsl:template match="d:tfoot">
700 <xsl:variable name="tgroup" select="parent::*"/>
702 <fo:table-footer start-indent="0pt" end-indent="0pt">
704 <!-- Use recursion if @morerows is used -->
705 <xsl:when test="d:row/d:entry/@morerows|d:row/d:entrytbl/@morerows">
706 <xsl:apply-templates select="d:row[1]">
707 <xsl:with-param name="spans">
708 <xsl:call-template name="blank.spans">
709 <xsl:with-param name="cols" select="../@cols"/>
712 <xsl:with-param name="browserows" select="'recurse'"/>
713 </xsl:apply-templates>
716 <xsl:apply-templates select="d:row">
717 <xsl:with-param name="spans">
718 <xsl:call-template name="blank.spans">
719 <xsl:with-param name="cols" select="../@cols"/>
722 <xsl:with-param name="browserows" select="'loop'" />
723 </xsl:apply-templates>
729 <xsl:template match="d:tbody">
730 <xsl:variable name="tgroup" select="parent::*"/>
732 <fo:table-body start-indent="0pt" end-indent="0pt">
734 <!-- Use recursion if @morerows is used -->
735 <xsl:when test="d:row/d:entry/@morerows|d:row/d:entrytbl/@morerows">
736 <xsl:apply-templates select="d:row[1]">
737 <xsl:with-param name="spans">
738 <xsl:call-template name="blank.spans">
739 <xsl:with-param name="cols" select="../@cols"/>
742 <xsl:with-param name="browserows" select="'recurse'"/>
743 </xsl:apply-templates>
746 <xsl:apply-templates select="d:row">
747 <xsl:with-param name="spans">
748 <xsl:call-template name="blank.spans">
749 <xsl:with-param name="cols" select="../@cols"/>
752 <xsl:with-param name="browserows" select="'loop'" />
753 </xsl:apply-templates>
759 <xsl:template match="d:row">
760 <xsl:param name="spans"/>
761 <xsl:param name="browserows"/>
764 <xsl:when test="contains($spans, '0')">
765 <xsl:call-template name="normal-row">
766 <xsl:with-param name="spans" select="$spans"/>
767 <xsl:with-param name="browserows" select="$browserows"/>
773 <xsl:text>Ignoring row: </xsl:text>
774 <xsl:value-of select="$spans"/>
775 <xsl:text> = </xsl:text>
776 <xsl:call-template name="consume-row">
777 <xsl:with-param name="spans" select="$spans"/>
782 <xsl:if test="normalize-space(.//text()) != ''">
783 <xsl:message>Warning: overlapped row contains content!</xsl:message>
787 <xsl:comment> This row intentionally left blank </xsl:comment>
788 <fo:table-cell><fo:block/></fo:table-cell>
791 <xsl:if test="$browserows = 'recurse'">
792 <xsl:apply-templates select="following-sibling::d:row[1]">
793 <xsl:with-param name="spans">
794 <xsl:call-template name="consume-row">
795 <xsl:with-param name="spans" select="$spans"/>
798 <xsl:with-param name="browserows" select="$browserows"/>
799 </xsl:apply-templates>
805 <xsl:template name="normal-row">
806 <xsl:param name="spans"/>
807 <xsl:param name="browserows"/>
810 <xsl:call-template name="table.row.properties"/>
811 <xsl:call-template name="anchor"/>
813 <xsl:apply-templates select="(d:entry|d:entrytbl)[1]">
814 <xsl:with-param name="spans" select="$spans"/>
815 </xsl:apply-templates>
818 <xsl:if test="$browserows = 'recurse'">
819 <xsl:if test="following-sibling::d:row">
820 <xsl:variable name="nextspans">
821 <xsl:apply-templates select="(d:entry|d:entrytbl)[1]" mode="span">
822 <xsl:with-param name="spans" select="$spans"/>
823 </xsl:apply-templates>
826 <xsl:apply-templates select="following-sibling::d:row[1]">
827 <xsl:with-param name="spans" select="$nextspans"/>
828 <xsl:with-param name="browserows" select="$browserows"/>
829 </xsl:apply-templates>
834 <!-- customize this template to add row properties -->
835 <xsl:template name="table.row.properties">
837 <xsl:variable name="row-height">
838 <xsl:if test="processing-instruction('dbfo')">
839 <xsl:call-template name="pi.dbfo_row-height"/>
843 <xsl:if test="$row-height != ''">
844 <xsl:attribute name="block-progression-dimension">
845 <xsl:value-of select="$row-height"/>
849 <xsl:variable name="bgcolor">
850 <xsl:call-template name="pi.dbfo_bgcolor"/>
853 <xsl:if test="$bgcolor != ''">
854 <xsl:attribute name="background-color">
855 <xsl:value-of select="$bgcolor"/>
859 <!-- Keep header row with next row -->
860 <xsl:if test="ancestor::d:thead">
861 <xsl:attribute name="keep-with-next.within-column">always</xsl:attribute>
866 <xsl:template match="d:entry|d:entrytbl" name="entry">
867 <xsl:param name="col" select="1"/>
868 <xsl:param name="spans"/>
870 <xsl:variable name="row" select="parent::d:row"/>
871 <xsl:variable name="group" select="$row/parent::*[1]"/>
872 <xsl:variable name="frame" select="ancestor::d:tgroup/parent::*/@frame"/>
874 <xsl:variable name="empty.cell" select="count(node()) = 0"/>
876 <xsl:variable name="named.colnum">
877 <xsl:call-template name="entry.colnum"/>
880 <xsl:variable name="entry.colnum">
882 <xsl:when test="$named.colnum > 0">
883 <xsl:value-of select="$named.colnum"/>
886 <xsl:value-of select="$col"/>
891 <xsl:variable name="entry.colspan">
893 <xsl:when test="@spanname or @namest">
894 <xsl:call-template name="calculate.colspan"/>
896 <xsl:otherwise>1</xsl:otherwise>
900 <xsl:variable name="following.spans">
901 <xsl:call-template name="calculate.following.spans">
902 <xsl:with-param name="colspan" select="$entry.colspan"/>
903 <xsl:with-param name="spans" select="$spans"/>
907 <xsl:variable name="rowsep">
909 <!-- If this is the last row, rowsep never applies (except when
910 the ancestor tgroup has a following sibling tgroup) -->
911 <xsl:when test="not(ancestor-or-self::d:row[1]/following-sibling::d:row
912 or ancestor-or-self::d:thead/following-sibling::d:tbody
913 or ancestor-or-self::d:tbody/preceding-sibling::d:tfoot)
914 and not(ancestor::d:tgroup/following-sibling::d:tgroup)">
915 <xsl:value-of select="0"/>
917 <!-- Check for morerows too -->
918 <xsl:when test="(@morerows and count(ancestor-or-self::d:row[1]/
919 following-sibling::d:row) = @morerows )
920 and not (ancestor-or-self::d:thead/following-sibling::d:tbody
921 or ancestor-or-self::d:tbody/preceding-sibling::d:tfoot)
922 and not(ancestor::d:tgroup/following-sibling::d:tgroup)">
923 <xsl:value-of select="0"/>
927 <xsl:call-template name="inherited.table.attribute">
928 <xsl:with-param name="entry" select="."/>
929 <xsl:with-param name="colnum" select="$entry.colnum"/>
930 <xsl:with-param name="attribute" select="'rowsep'"/>
937 <xsl:message><xsl:value-of select="."/>: <xsl:value-of select="$rowsep"/></xsl:message>
940 <xsl:variable name="colsep">
942 <!-- If this is the last column, colsep never applies. -->
943 <xsl:when test="$following.spans = ''">0</xsl:when>
945 <xsl:call-template name="inherited.table.attribute">
946 <xsl:with-param name="entry" select="."/>
947 <xsl:with-param name="colnum" select="$entry.colnum"/>
948 <xsl:with-param name="attribute" select="'colsep'"/>
954 <xsl:variable name="valign">
955 <xsl:call-template name="inherited.table.attribute">
956 <xsl:with-param name="entry" select="."/>
957 <xsl:with-param name="colnum" select="$entry.colnum"/>
958 <xsl:with-param name="attribute" select="'valign'"/>
962 <xsl:variable name="align">
963 <xsl:call-template name="inherited.table.attribute">
964 <xsl:with-param name="entry" select="."/>
965 <xsl:with-param name="colnum" select="$entry.colnum"/>
966 <xsl:with-param name="attribute" select="'align'"/>
970 <xsl:variable name="char">
971 <xsl:call-template name="inherited.table.attribute">
972 <xsl:with-param name="entry" select="."/>
973 <xsl:with-param name="colnum" select="$entry.colnum"/>
974 <xsl:with-param name="attribute" select="'char'"/>
978 <xsl:variable name="charoff">
979 <xsl:call-template name="inherited.table.attribute">
980 <xsl:with-param name="entry" select="."/>
981 <xsl:with-param name="colnum" select="$entry.colnum"/>
982 <xsl:with-param name="attribute" select="'charoff'"/>
987 <xsl:when test="$spans != '' and not(starts-with($spans,'0:'))">
988 <xsl:call-template name="entry">
989 <xsl:with-param name="col" select="$col+1"/>
990 <xsl:with-param name="spans" select="substring-after($spans,':')"/>
994 <xsl:when test="number($entry.colnum) > $col">
995 <xsl:call-template name="empty.table.cell">
996 <xsl:with-param name="colnum" select="$col"/>
998 <xsl:call-template name="entry">
999 <xsl:with-param name="col" select="$col+1"/>
1000 <xsl:with-param name="spans" select="substring-after($spans,':')"/>
1001 </xsl:call-template>
1005 <xsl:variable name="cell.content">
1007 <xsl:call-template name="table.cell.block.properties"/>
1009 <!-- are we missing any indexterms? -->
1010 <xsl:if test="not(preceding-sibling::d:entry)
1011 and not(parent::d:row/preceding-sibling::d:row)">
1012 <!-- this is the first entry of the first row -->
1013 <xsl:if test="ancestor::d:thead or
1015 and not(ancestor::d:tbody/preceding-sibling::d:thead
1016 or ancestor::d:tbody/preceding-sibling::d:tbody))">
1017 <!-- of the thead or the first tbody -->
1018 <xsl:apply-templates select="ancestor::d:tgroup/preceding-sibling::d:indexterm"/>
1023 <xsl:text>(</xsl:text>
1024 <xsl:value-of select="$rowsep"/>
1025 <xsl:text>,</xsl:text>
1026 <xsl:value-of select="$colsep"/>
1027 <xsl:text>)</xsl:text>
1030 <xsl:when test="$empty.cell">
1031 <xsl:text> </xsl:text>
1033 <xsl:when test="self::d:entrytbl">
1034 <xsl:variable name="prop-columns"
1035 select=".//d:colspec[contains(@colwidth, '*')]"/>
1036 <fo:table xsl:use-attribute-sets="table.table.properties">
1037 <xsl:if test="count($prop-columns) != 0">
1038 <xsl:attribute name="table-layout">fixed</xsl:attribute>
1040 <xsl:call-template name="tgroup"/>
1044 <xsl:apply-templates/>
1050 <xsl:variable name="cell-orientation">
1051 <xsl:call-template name="pi.dbfo_orientation">
1052 <xsl:with-param name="node" select="ancestor-or-self::d:entry"/>
1053 </xsl:call-template>
1056 <xsl:variable name="row-orientation">
1057 <xsl:call-template name="pi.dbfo_orientation">
1058 <xsl:with-param name="node" select="ancestor-or-self::d:row"/>
1059 </xsl:call-template>
1062 <xsl:variable name="cell-width">
1063 <xsl:call-template name="pi.dbfo_rotated-width">
1064 <xsl:with-param name="node" select="ancestor-or-self::d:entry"/>
1065 </xsl:call-template>
1068 <xsl:variable name="row-width">
1069 <xsl:call-template name="pi.dbfo_rotated-width">
1070 <xsl:with-param name="node" select="ancestor-or-self::d:row"/>
1071 </xsl:call-template>
1074 <xsl:variable name="orientation">
1076 <xsl:when test="$cell-orientation != ''">
1077 <xsl:value-of select="$cell-orientation"/>
1080 <xsl:value-of select="$row-orientation"/>
1085 <xsl:variable name="rotated-width">
1087 <xsl:when test="$cell-width != ''">
1088 <xsl:value-of select="$cell-width"/>
1091 <xsl:value-of select="$row-width"/>
1096 <xsl:variable name="bgcolor">
1097 <xsl:call-template name="pi.dbfo_bgcolor">
1098 <xsl:with-param name="node" select="ancestor-or-self::d:entry"/>
1099 </xsl:call-template>
1102 <fo:table-cell xsl:use-attribute-sets="table.cell.padding">
1103 <xsl:call-template name="table.cell.properties">
1104 <xsl:with-param name="bgcolor.pi" select="$bgcolor"/>
1105 <xsl:with-param name="rowsep.inherit" select="$rowsep"/>
1106 <xsl:with-param name="colsep.inherit" select="$colsep"/>
1107 <xsl:with-param name="col" select="$col"/>
1108 <xsl:with-param name="valign.inherit" select="$valign"/>
1109 <xsl:with-param name="align.inherit" select="$align"/>
1110 <xsl:with-param name="char.inherit" select="$char"/>
1111 </xsl:call-template>
1113 <xsl:call-template name="anchor"/>
1115 <xsl:if test="@morerows">
1116 <xsl:attribute name="number-rows-spanned">
1117 <xsl:value-of select="@morerows+1"/>
1121 <xsl:if test="$entry.colspan > 1">
1122 <xsl:attribute name="number-columns-spanned">
1123 <xsl:value-of select="$entry.colspan"/>
1128 <xsl:if test="@charoff">
1129 <xsl:attribute name="charoff">
1130 <xsl:value-of select="@charoff"/>
1136 <xsl:when test="$fop.extensions = 0
1137 and $orientation != ''">
1138 <fo:block-container reference-orientation="{$orientation}">
1139 <xsl:if test="$rotated-width != ''">
1140 <xsl:attribute name="width">
1141 <xsl:value-of select="$rotated-width"/>
1144 <xsl:copy-of select="$cell.content"/>
1145 </fo:block-container>
1148 <xsl:copy-of select="$cell.content"/>
1154 <xsl:when test="following-sibling::d:entry|following-sibling::d:entrytbl">
1155 <xsl:apply-templates select="(following-sibling::d:entry
1156 |following-sibling::d:entrytbl)[1]">
1157 <xsl:with-param name="col" select="$col+$entry.colspan"/>
1158 <xsl:with-param name="spans" select="$following.spans"/>
1159 </xsl:apply-templates>
1162 <xsl:call-template name="finaltd">
1163 <xsl:with-param name="spans" select="$following.spans"/>
1164 <xsl:with-param name="col" select="$col+$entry.colspan"/>
1165 </xsl:call-template>
1172 <!-- Expand this template to add properties to any fo:table-cell -->
1173 <xsl:template name="table.cell.properties">
1174 <xsl:param name="bgcolor.pi" select="''"/>
1175 <xsl:param name="rowsep.inherit" select="1"/>
1176 <xsl:param name="colsep.inherit" select="1"/>
1177 <xsl:param name="col" select="1"/>
1178 <xsl:param name="valign.inherit" select="''"/>
1179 <xsl:param name="align.inherit" select="''"/>
1180 <xsl:param name="char.inherit" select="''"/>
1183 <xsl:when test="ancestor::d:tgroup">
1184 <xsl:if test="$bgcolor.pi != ''">
1185 <xsl:attribute name="background-color">
1186 <xsl:value-of select="$bgcolor.pi"/>
1190 <xsl:if test="$rowsep.inherit > 0">
1191 <xsl:call-template name="border">
1192 <xsl:with-param name="side" select="'bottom'"/>
1193 </xsl:call-template>
1196 <xsl:if test="$colsep.inherit > 0 and
1197 $col < (ancestor::d:tgroup/@cols|ancestor::d:entrytbl/@cols)[last()]">
1198 <xsl:call-template name="border">
1199 <xsl:with-param name="side" select="'end'"/>
1200 </xsl:call-template>
1203 <xsl:if test="$valign.inherit != ''">
1204 <xsl:attribute name="display-align">
1206 <xsl:when test="$valign.inherit='top'">before</xsl:when>
1207 <xsl:when test="$valign.inherit='middle'">center</xsl:when>
1208 <xsl:when test="$valign.inherit='bottom'">after</xsl:when>
1211 <xsl:text>Unexpected valign value: </xsl:text>
1212 <xsl:value-of select="$valign.inherit"/>
1213 <xsl:text>, center used.</xsl:text>
1215 <xsl:text>center</xsl:text>
1222 <xsl:when test="$align.inherit = 'char' and $char.inherit != ''">
1223 <xsl:attribute name="text-align">
1224 <xsl:value-of select="$char.inherit"/>
1227 <xsl:when test="$align.inherit != ''">
1228 <xsl:attribute name="text-align">
1229 <xsl:value-of select="$align.inherit"/>
1237 <xsl:if test="$bgcolor.pi != ''">
1238 <xsl:attribute name="background-color">
1239 <xsl:value-of select="$bgcolor.pi"/>
1243 <xsl:if test="$align.inherit != ''">
1244 <xsl:attribute name="text-align">
1245 <xsl:value-of select="$align.inherit"/>
1249 <xsl:if test="$valign.inherit != ''">
1250 <xsl:attribute name="display-align">
1252 <xsl:when test="$valign.inherit='top'">before</xsl:when>
1253 <xsl:when test="$valign.inherit='middle'">center</xsl:when>
1254 <xsl:when test="$valign.inherit='bottom'">after</xsl:when>
1257 <xsl:text>Unexpected valign value: </xsl:text>
1258 <xsl:value-of select="$valign.inherit"/>
1259 <xsl:text>, center used.</xsl:text>
1261 <xsl:text>center</xsl:text>
1267 <xsl:call-template name="html.table.cell.rules"/>
1274 <!-- Expand this template to add properties to any cell's block -->
1275 <xsl:template name="table.cell.block.properties">
1276 <!-- highlight this entry? -->
1278 <xsl:when test="ancestor::d:thead or ancestor::d:tfoot">
1279 <xsl:attribute name="font-weight">bold</xsl:attribute>
1281 <!-- Make row headers bold too -->
1282 <xsl:when test="ancestor::d:tbody and
1283 (ancestor::d:table[@rowheader = 'firstcol'] or
1284 ancestor::d:informaltable[@rowheader = 'firstcol']) and
1285 ancestor-or-self::d:entry[1][count(preceding-sibling::d:entry) = 0]">
1286 <xsl:attribute name="font-weight">bold</xsl:attribute>
1291 <xsl:template match="d:entry|d:entrytbl" name="sentry" mode="span">
1292 <xsl:param name="col" select="1"/>
1293 <xsl:param name="spans"/>
1295 <xsl:variable name="entry.colnum">
1296 <xsl:call-template name="entry.colnum"/>
1299 <xsl:variable name="entry.colspan">
1301 <xsl:when test="@spanname or @namest">
1302 <xsl:call-template name="calculate.colspan"/>
1304 <xsl:otherwise>1</xsl:otherwise>
1308 <xsl:variable name="following.spans">
1309 <xsl:call-template name="calculate.following.spans">
1310 <xsl:with-param name="colspan" select="$entry.colspan"/>
1311 <xsl:with-param name="spans" select="$spans"/>
1312 </xsl:call-template>
1316 <xsl:when test="$spans != '' and not(starts-with($spans,'0:'))">
1317 <xsl:value-of select="substring-before($spans,':')-1"/>
1318 <xsl:text>:</xsl:text>
1319 <xsl:call-template name="sentry">
1320 <xsl:with-param name="col" select="$col+1"/>
1321 <xsl:with-param name="spans" select="substring-after($spans,':')"/>
1322 </xsl:call-template>
1325 <xsl:when test="number($entry.colnum) > $col">
1326 <xsl:text>0:</xsl:text>
1327 <xsl:call-template name="sentry">
1328 <xsl:with-param name="col" select="$col + 1"/>
1329 <xsl:with-param name="spans" select="substring-after($spans,':')"/>
1330 </xsl:call-template>
1334 <xsl:call-template name="copy-string">
1335 <xsl:with-param name="count" select="$entry.colspan"/>
1336 <xsl:with-param name="string">
1338 <xsl:when test="@morerows">
1339 <xsl:value-of select="@morerows"/>
1341 <xsl:otherwise>0</xsl:otherwise>
1343 <xsl:text>:</xsl:text>
1345 </xsl:call-template>
1348 <xsl:when test="following-sibling::d:entry|following-sibling::d:entrytbl">
1349 <xsl:apply-templates select="(following-sibling::d:entry
1350 |following-sibling::d:entrytbl)[1]"
1352 <xsl:with-param name="col" select="$col+$entry.colspan"/>
1353 <xsl:with-param name="spans" select="$following.spans"/>
1354 </xsl:apply-templates>
1357 <xsl:call-template name="sfinaltd">
1358 <xsl:with-param name="spans" select="$following.spans"/>
1359 </xsl:call-template>
1366 <xsl:template name="generate.colgroup.raw">
1367 <xsl:param name="cols" select="1"/>
1368 <xsl:param name="count" select="1"/>
1371 <xsl:when test="$count>$cols"></xsl:when>
1373 <xsl:call-template name="generate.col.raw">
1374 <xsl:with-param name="countcol" select="$count"/>
1375 </xsl:call-template>
1376 <xsl:call-template name="generate.colgroup.raw">
1377 <xsl:with-param name="cols" select="$cols"/>
1378 <xsl:with-param name="count" select="$count+1"/>
1379 </xsl:call-template>
1384 <xsl:template name="generate.colgroup">
1385 <xsl:param name="cols" select="1"/>
1386 <xsl:param name="count" select="1"/>
1389 <xsl:when test="$count>$cols"></xsl:when>
1391 <xsl:call-template name="generate.col">
1392 <xsl:with-param name="countcol" select="$count"/>
1393 </xsl:call-template>
1394 <xsl:call-template name="generate.colgroup">
1395 <xsl:with-param name="cols" select="$cols"/>
1396 <xsl:with-param name="count" select="$count+1"/>
1397 </xsl:call-template>
1402 <xsl:template name="generate.col.raw">
1403 <!-- generate the table-column for column countcol -->
1404 <xsl:param name="countcol">1</xsl:param>
1405 <xsl:param name="colspecs" select="./d:colspec"/>
1406 <xsl:param name="count">1</xsl:param>
1407 <xsl:param name="colnum">1</xsl:param>
1410 <xsl:when test="$count>count($colspecs)">
1411 <fo:table-column column-number="{$countcol}"/>
1414 <xsl:variable name="colspec" select="$colspecs[$count=position()]"/>
1416 <xsl:variable name="colspec.colnum">
1418 <xsl:when test="$colspec/@colnum">
1419 <xsl:value-of select="$colspec/@colnum"/>
1422 <xsl:value-of select="$colnum"/>
1427 <xsl:variable name="colspec.colwidth">
1429 <xsl:when test="normalize-space($colspec/@colwidth)='*'">1*</xsl:when>
1430 <xsl:when test="$colspec/@colwidth">
1431 <xsl:value-of select="$colspec/@colwidth"/>
1433 <xsl:otherwise>1*</xsl:otherwise>
1438 <xsl:when test="$colspec.colnum=$countcol">
1439 <fo:table-column column-number="{$countcol}">
1440 <xsl:attribute name="column-width">
1441 <xsl:value-of select="$colspec.colwidth"/>
1446 <xsl:call-template name="generate.col.raw">
1447 <xsl:with-param name="countcol" select="$countcol"/>
1448 <xsl:with-param name="colspecs" select="$colspecs"/>
1449 <xsl:with-param name="count" select="$count+1"/>
1450 <xsl:with-param name="colnum">
1452 <xsl:when test="$colspec/@colnum">
1453 <xsl:value-of select="$colspec/@colnum + 1"/>
1456 <xsl:value-of select="$colnum + 1"/>
1460 </xsl:call-template>
1467 <xsl:template name="generate.col">
1468 <!-- generate the table-column for column countcol -->
1469 <xsl:param name="countcol">1</xsl:param>
1470 <xsl:param name="colspecs" select="./d:colspec"/>
1471 <xsl:param name="count">1</xsl:param>
1472 <xsl:param name="colnum">1</xsl:param>
1475 <xsl:when test="$count>count($colspecs)">
1476 <fo:table-column column-number="{$countcol}">
1477 <xsl:variable name="colwidth">
1478 <xsl:call-template name="calc.column.width"/>
1480 <xsl:attribute name="column-width">
1481 <xsl:value-of select="$colwidth"/>
1486 <xsl:variable name="colspec" select="$colspecs[$count=position()]"/>
1488 <xsl:variable name="colspec.colnum">
1490 <xsl:when test="$colspec/@colnum">
1491 <xsl:value-of select="$colspec/@colnum"/>
1494 <xsl:value-of select="$colnum"/>
1499 <xsl:variable name="colspec.colwidth">
1501 <xsl:when test="$colspec/@colwidth">
1502 <xsl:value-of select="$colspec/@colwidth"/>
1504 <xsl:otherwise>1*</xsl:otherwise>
1509 <xsl:when test="$colspec.colnum=$countcol">
1510 <fo:table-column column-number="{$countcol}">
1511 <xsl:variable name="colwidth">
1512 <xsl:call-template name="calc.column.width">
1513 <xsl:with-param name="colwidth">
1514 <xsl:value-of select="$colspec.colwidth"/>
1516 </xsl:call-template>
1518 <xsl:attribute name="column-width">
1519 <xsl:value-of select="$colwidth"/>
1524 <xsl:call-template name="generate.col">
1525 <xsl:with-param name="countcol" select="$countcol"/>
1526 <xsl:with-param name="colspecs" select="$colspecs"/>
1527 <xsl:with-param name="count" select="$count+1"/>
1528 <xsl:with-param name="colnum">
1530 <xsl:when test="$colspec/@colnum">
1531 <xsl:value-of select="$colspec/@colnum + 1"/>
1534 <xsl:value-of select="$colnum + 1"/>
1538 </xsl:call-template>
1545 <doc:template name="calc.column.width" xmlns="">
1546 <refpurpose>Calculate an XSL FO table column width specification from a
1547 CALS table column width specification.</refpurpose>
1550 <para>CALS expresses table column widths in the following basic
1555 <para><emphasis>99.99units</emphasis>, a fixed length specifier.</para>
1558 <para><emphasis>99.99</emphasis>, a fixed length specifier without any units.</para>
1561 <para><emphasis>99.99*</emphasis>, a relative length specifier.</para>
1564 <para><emphasis>99.99*+99.99units</emphasis>, a combination of both.</para>
1568 <para>The CALS units are points (pt), picas (pi), centimeters (cm),
1569 millimeters (mm), and inches (in). These are the same units as XSL,
1570 except that XSL abbreviates picas "pc" instead of "pi". If a length
1571 specifier has no units, the CALS default unit (pt) is assumed.</para>
1573 <para>Relative length specifiers are represented in XSL with the
1574 proportional-column-width() function.</para>
1576 <para>Here are some examples:</para>
1580 <para>"36pt" becomes "36pt"</para>
1583 <para>"3pi" becomes "3pc"</para>
1586 <para>"36" becomes "36pt"</para>
1589 <para>"3*" becomes "proportional-column-width(3)"</para>
1592 <para>"3*+2pi" becomes "proportional-column-width(3)+2pc"</para>
1595 <para>"1*+2" becomes "proportional-column-width(1)+2pt"</para>
1602 <varlistentry><term>colwidth</term>
1604 <para>The CALS column width specification.</para>
1611 <para>The XSL column width specification.</para>
1615 <xsl:template name="calc.column.width">
1616 <xsl:param name="colwidth">1*</xsl:param>
1618 <!-- Ok, the colwidth could have any one of the following forms: -->
1619 <!-- 1* = proportional width -->
1620 <!-- * = same as 1* -->
1621 <!-- 1unit = 1.0 units wide -->
1622 <!-- 1 = 1pt wide -->
1623 <!-- 1*+1unit = proportional width + some fixed width -->
1624 <!-- 1*+1 = proportional width + some fixed width -->
1626 <!-- If it has a proportional width, translate it to XSL -->
1627 <xsl:if test="contains($colwidth, '*')">
1628 <xsl:text>proportional-column-width(</xsl:text>
1630 <xsl:when test="substring-before($colwidth, '*') != ''">
1631 <xsl:value-of select="substring-before($colwidth, '*')"/>
1634 <xsl:text>1.00</xsl:text>
1637 <xsl:text>)</xsl:text>
1640 <!-- Now grab the non-proportional part of the specification -->
1641 <xsl:variable name="width-units">
1643 <xsl:when test="contains($colwidth, '*')">
1645 select="normalize-space(substring-after($colwidth, '*'))"/>
1648 <xsl:value-of select="normalize-space($colwidth)"/>
1653 <!-- Ok, now the width-units could have any one of the following forms: -->
1654 <!-- = <empty string> -->
1655 <!-- 1unit = 1.0 units wide -->
1656 <!-- 1 = 1pt wide -->
1657 <!-- with an optional leading sign -->
1659 <!-- Grab the width part by blanking out the units part and discarding -->
1660 <!-- whitespace. It's not pretty, but it works. -->
1661 <xsl:variable name="width"
1662 select="normalize-space(translate($width-units,
1663 '+-0123456789.abcdefghijklmnopqrstuvwxyz',
1664 '+-0123456789.'))"/>
1666 <!-- Grab the units part by blanking out the width part and discarding -->
1667 <!-- whitespace. It's not pretty, but it works. -->
1668 <xsl:variable name="units"
1669 select="normalize-space(translate($width-units,
1670 'abcdefghijklmnopqrstuvwxyz+-0123456789.',
1671 'abcdefghijklmnopqrstuvwxyz'))"/>
1673 <!-- Output the width -->
1674 <xsl:value-of select="$width"/>
1676 <!-- Output the units, translated appropriately -->
1678 <xsl:when test="$units = 'pi'">pc</xsl:when>
1679 <xsl:when test="$units = '' and $width != ''">pt</xsl:when>
1680 <xsl:otherwise><xsl:value-of select="$units"/></xsl:otherwise>
1684 <xsl:template match="d:table/d:caption">
1685 <fo:block xsl:use-attribute-sets="table.caption.properties">
1686 <xsl:apply-templates/>
1690 <!-- ==================================================================== -->