2 <!--#############################################################################
3 |- #############################################################################
6 + ############################################################################## -->
8 xmlns:
xsl=
"http://www.w3.org/1999/XSL/Transform"
9 xmlns:
doc=
"http://nwalsh.com/xsl/documentation/1.0"
10 exclude-result-prefixes=
"doc" version='
1.0'
>
14 <!--############################################################################# -->
15 <!-- DOCUMENTATION -->
16 <doc:reference id=
"table" xmlns=
"">
18 <releaseinfo role=
"meta">
21 <firstname>Ramon
</firstname> <surname>Casellas
</surname>
22 <firstname>James
</firstname> <surname>Devenish
</surname>
25 <year>2000</year> <year>2001</year> <year>2002</year> <year>2003</year>
26 <holder>Ramon Casellas
</holder>
30 <title>Tables
<filename>table.mod.xsl
</filename></title>
32 <section><title>Introduction
</title>
41 <!--############################################################################# -->
42 <!-- DOCUMENTATION -->
43 <doc:template match=
"table|informaltable" xmlns=
"">
44 <refpurpose>XSL template for docbook tables.
</refpurpose>
47 <formalpara><title>Remarks and Bugs
</title>
51 <formalpara><title>Default Behaviour
</title>
56 <!--############################################################################# -->
58 <xsl:template match=
"table">
59 <xsl:variable name=
"placement">
60 <xsl:call-template name=
"generate.formal.title.placement">
61 <xsl:with-param name=
"object" select=
"local-name(.)" />
64 <xsl:variable name=
"caption">
65 <xsl:text>\caption{
</xsl:text>
66 <xsl:apply-templates select=
"title" mode=
"caption.mode"/>
67 <xsl:text>}
</xsl:text>
69 <xsl:call-template name=
"map.begin"/>
70 <xsl:if test=
"$placement='before'">
71 <xsl:text>\captionswapskip{}
</xsl:text>
72 <xsl:value-of select=
"$caption" />
73 <xsl:text>\captionswapskip{}
</xsl:text>
75 <xsl:apply-templates/>
76 <xsl:if test=
"$placement!='before'"><xsl:value-of select=
"$caption" /></xsl:if>
77 <xsl:call-template name=
"map.end"/>
80 <xsl:template match=
"table/title"/>
81 <xsl:template match=
"table/title" mode=
"caption.mode"><xsl:apply-templates /></xsl:template>
83 <xsl:template match=
"informaltable">
84 <xsl:call-template name=
"map.begin"/>
85 <xsl:apply-templates/>
86 <xsl:call-template name=
"map.end"/>
90 <xsl:template name=
"table.format.tabularx">
91 <xsl:param name=
"cols" select=
"1"/>
92 <xsl:param name=
"i" select=
"1"/>
93 <xsl:param name=
"colsep" select=
"1"/>
94 <!-- sum of numeric portions in 1*-like colwidths -->
95 <xsl:param name=
"starfactor" select=
"0"/>
97 <!-- Out of the recursive iteration -->
98 <xsl:when test=
"$i > $cols"></xsl:when>
99 <!-- There are still columns to count -->
101 <xsl:variable name=
"width">
102 <xsl:variable name=
"userchoice" select=
"colspec[@colnum=$i]/@colwidth"/>
103 <xsl:variable name=
"cells" select=
"thead/row/entry[$i]|tbody/row/entry[$i]"/>
105 <xsl:when test=
"string-length($userchoice)=0 and count($cells//itemizedlist|$cells//orderedlist|$cells//variablelist)>0">
106 <!-- In these specific circumstances, we MUST use a line-wrapped column
107 and yet the user hasn't specified one. -->
108 <xsl:value-of select=
"'1*'"/>
111 <!-- In the general case, we just do what the user wants (may even
112 have no pre-specified width). -->
113 <xsl:value-of select=
"$userchoice"/>
117 <!-- Try to take heed of colspecs -->
119 <xsl:when test=
"$width!=''">
120 <xsl:text>>{
</xsl:text>
121 <xsl:if test=
"contains($width,'*')">
122 <!-- see tabularx documentation -->
123 <xsl:text>\hsize=
</xsl:text>
124 <xsl:value-of select=
"substring-before($width,'*') * $starfactor" />
125 <xsl:text>\hsize
</xsl:text>
128 <xsl:when test=
"colspec[@colnum=$i]/@align='left'"><xsl:text>\RaggedRight
</xsl:text></xsl:when>
129 <xsl:when test=
"colspec[@colnum=$i]/@align='right'"><xsl:text>\RaggedLeft
</xsl:text></xsl:when>
130 <xsl:when test=
"colspec[@colnum=$i]/@align='center'"><xsl:text>\Centering
</xsl:text></xsl:when>
131 <xsl:when test=
"colspec[@colnum=$i]/@align='char'"><xsl:message>Table column char alignment is not supported.
</xsl:message></xsl:when>
133 <xsl:text>}
</xsl:text>
135 <xsl:when test=
"contains($width,'*')">
136 <xsl:text>X
</xsl:text>
139 <xsl:text>p{
</xsl:text><xsl:value-of select=
"$width" /><xsl:text>}
</xsl:text>
142 <xsl:if test=
"$i<$cols and $colsep='1'">
143 <xsl:text>|
</xsl:text>
148 <xsl:when test=
"colspec[@colnum=$i]/@align='left'"><xsl:text>l
</xsl:text></xsl:when>
149 <xsl:when test=
"colspec[@colnum=$i]/@align='right'"><xsl:text>r
</xsl:text></xsl:when>
150 <xsl:when test=
"colspec[@colnum=$i]/@align='center'"><xsl:text>c
</xsl:text></xsl:when>
151 <xsl:when test=
"colspec[@colnum=$i]/@align='justify'"><xsl:text>X
</xsl:text></xsl:when>
152 <xsl:when test=
"colspec[@colnum=$i]/@align='char'"><xsl:text>c
</xsl:text><xsl:message>Table column char alignment is not supported.
</xsl:message></xsl:when>
153 <xsl:otherwise><xsl:text>X
</xsl:text></xsl:otherwise>
155 <xsl:if test=
"$i<$cols and $colsep='1'">
156 <xsl:text>|
</xsl:text>
160 <!-- Recursive for next column -->
161 <xsl:call-template name=
"table.format.tabularx">
162 <xsl:with-param name=
"i" select=
"$i+1"/>
163 <xsl:with-param name=
"cols" select=
"$cols"/>
164 <xsl:with-param name=
"starfactor" select=
"$starfactor"/>
172 <xsl:template name=
"table.format.tabular">
173 <xsl:param name=
"cols" select=
"1"/>
174 <xsl:param name=
"i" select=
"1"/>
175 <xsl:param name=
"colsep" select=
"1"/>
177 <!-- Out of the recursive iteration -->
178 <xsl:when test=
"$i > $cols"></xsl:when>
179 <!-- There are still columns to count -->
181 <!-- Try to take heed of colspecs -->
183 <!-- RC 2003/03/19 : Added first 'test' : colspec[@colnum=$i] for xsltproc
184 Before this patch, parsing the doc with xsltproc the xsl:when clause
185 was evaluated to 'true' even if there was no colspec for the column
187 <xsl:when test=
"colspec[@colnum=$i] and colspec[@colnum=$i]/@colwidth!='' and not(contains(colspec[@colnum=$i]/@colwidth,'*'))">
189 <xsl:when test=
"colspec[@colnum=$i]/@align='left'"><xsl:text>>{\RaggedRight}
</xsl:text></xsl:when>
190 <xsl:when test=
"colspec[@colnum=$i]/@align='right'"><xsl:text>>{\RaggedLeft}
</xsl:text></xsl:when>
191 <xsl:when test=
"colspec[@colnum=$i]/@align='center'"><xsl:text>>{\Centering}
</xsl:text></xsl:when>
192 <xsl:when test=
"colspec[@colnum=$i]/@align='char'"><xsl:message>Table column char alignment is not supported.
</xsl:message></xsl:when>
194 <xsl:text>p{
</xsl:text><xsl:value-of select=
"colspec[@colnum=$i]/@colwidth" /><xsl:text>}
</xsl:text>
195 <xsl:if test=
"$i<$cols and $colsep='1'">
196 <xsl:text>|
</xsl:text>
201 <xsl:when test=
"colspec[@colnum=$i]/@align='left'"><xsl:text>l
</xsl:text></xsl:when>
202 <xsl:when test=
"colspec[@colnum=$i]/@align='right'"><xsl:text>r
</xsl:text></xsl:when>
203 <xsl:when test=
"colspec[@colnum=$i]/@align='center'"><xsl:text>c
</xsl:text></xsl:when>
204 <xsl:when test=
"colspec[@colnum=$i]/@align='justify'"><xsl:text>l
</xsl:text></xsl:when>
205 <xsl:when test=
"colspec[@colnum=$i]/@align='char'"><xsl:text>c
</xsl:text><xsl:message>Table column char alignment is not supported.
</xsl:message></xsl:when>
206 <xsl:otherwise><xsl:text>c
</xsl:text></xsl:otherwise>
208 <xsl:if test=
"$i<$cols and $colsep='1'">
209 <xsl:text>|
</xsl:text>
213 <!-- Recursive for next column -->
214 <xsl:call-template name=
"table.format.tabular">
215 <xsl:with-param name=
"i" select=
"$i+1"/>
216 <xsl:with-param name=
"cols" select=
"$cols"/>
224 <!-- See tabularx documentation. -->
225 <!-- For example, if we have a 1* column and a 3* column, then the
226 the hsizes for each column are (1/(1+3)*2) and (3/(1+3)*2).
227 The ratio of these to the star values (star values being 1 and 3)
229 BUT it is now very complicated because it takes into account columns
230 where the user has not specified a width but LaTeX requires a
231 fixed-width column (i.e. specialcols may vary).
232 Relies on there being (a) colspecs for every column or (b) no
235 <xsl:template name=
"generate.starfactor">
236 <xsl:param name=
"i" select=
"1"/>
237 <xsl:param name=
"cols" select=
"count(colspec)"/>
238 <xsl:param name=
"sum" select=
"0"/>
239 <xsl:param name=
"specialcols" select=
"count(colspec[contains(@colwidth,'*')])"/>
241 <xsl:when test=
"$i<=$cols and colspec[position()=$i and contains(@colwidth,'*')]">
243 <xsl:call-template name=
"generate.starfactor">
244 <xsl:with-param name=
"i" select=
"$i+1"/>
245 <xsl:with-param name=
"cols" select=
"$cols"/>
246 <xsl:with-param name=
"sum" select=
"$sum+substring-before(colspec[$i]/@colwidth,'*')"/>
247 <xsl:with-param name=
"specialcols" select=
"$specialcols"/>
250 <xsl:when test=
"$i<=$cols">
251 <!-- not a * column, but we are going to pretend that it is -->
252 <xsl:variable name=
"cells" select=
"thead/row/entry[$i]|tbody/row/entry[$i]"/>
253 <xsl:variable name=
"problems" select=
"count($cells//itemizedlist|$cells//orderedlist|$cells//variablelist)"/>
255 <xsl:when test=
"$problems > 0">
256 <xsl:call-template name=
"generate.starfactor">
257 <xsl:with-param name=
"i" select=
"$i+1"/>
258 <xsl:with-param name=
"cols" select=
"$cols"/>
259 <xsl:with-param name=
"sum" select=
"$sum+1"/>
260 <xsl:with-param name=
"specialcols" select=
"$specialcols+1"/>
264 <xsl:call-template name=
"generate.starfactor">
265 <xsl:with-param name=
"i" select=
"$i+1"/>
266 <xsl:with-param name=
"cols" select=
"$cols"/>
267 <xsl:with-param name=
"sum" select=
"$sum"/>
268 <xsl:with-param name=
"specialcols" select=
"$specialcols"/>
274 <xsl:value-of select=
"$specialcols div $sum"/>
280 <xsl:template match=
"tgroup">
281 <xsl:variable name=
"align" select=
"@align"/>
282 <xsl:variable name=
"frame">
284 <xsl:when test=
"string-length(../@frame)<1">all
</xsl:when>
286 <xsl:value-of select=
"../@frame"/>
290 <xsl:variable name=
"colspecs" select=
"./colspec"/>
291 <xsl:variable name=
"usex">
293 <!-- if there are lists within cells, we need tabularx -->
294 <xsl:when test=
"$latex.use.tabularx=1 and (descendant::itemizedlist|descendant::orderedlist|descendant::variablelist)">
295 <xsl:text>1</xsl:text>
297 <!-- if there are instances of 1*-style colwidths, we need tabularx -->
298 <xsl:when test=
"$latex.use.tabularx=1 and contains(colspec/@colwidth,'*')">
299 <xsl:text>1</xsl:text>
301 <!-- if there are colspecs with 'justify' alignment and no explicit width, we need tabularx -->
302 <xsl:when test=
"$latex.use.tabularx=1 and count(colspec[@align='justify'])>0">
303 <xsl:text>1</xsl:text>
306 <xsl:text>1</xsl:text>
310 <xsl:variable name=
"useminipage">
311 <!-- Hack to get around LaTeX issue with tabular (not necessary with tabularx).
312 This is NOT a good solution, and has problems of its own, but at least the footnotes
313 do not actually disappear (which is what would otherwise happen). -->
314 <xsl:if test=
"count(.//footnote)!=0">1</xsl:if>
317 <xsl:when test=
"$usex='1'">
318 <xsl:text>\begin{tabularx}{\linewidth}{
</xsl:text>
321 <xsl:if test=
"$useminipage='1'"><xsl:text>\begin{minipage}{\linewidth}
</xsl:text></xsl:if>
322 <xsl:text>\begin{tabular}{
</xsl:text>
325 <xsl:if test=
"$frame='all' or $frame='sides'">
326 <xsl:text>|
</xsl:text>
329 <xsl:when test=
"$usex=1">
330 <xsl:call-template name=
"table.format.tabularx">
331 <xsl:with-param name=
"cols" select=
"@cols"/>
332 <xsl:with-param name=
"starfactor">
333 <xsl:call-template name=
"generate.starfactor">
334 <xsl:with-param name=
"cols" select=
"@cols"/>
340 <xsl:call-template name=
"table.format.tabular">
341 <xsl:with-param name=
"cols" select=
"@cols"/>
345 <xsl:if test=
"$frame='all' or $frame='sides'">
346 <xsl:text>|
</xsl:text>
348 <xsl:text>}
</xsl:text>
349 <xsl:if test=
"$frame!='sides' and $frame!='none' and $frame!='bottom'">
350 <xsl:text>\hline
</xsl:text>
352 <!-- APPLY TEMPLATES -->
353 <xsl:apply-templates/>
355 <xsl:if test=
"$frame!='sides' and $frame!='none' and $frame!='top'">
356 <xsl:text>\hline
</xsl:text>
359 <xsl:when test=
"$usex=1">
360 <xsl:text>\end{tabularx}
</xsl:text>
363 <xsl:text>\end{tabular}
</xsl:text>
364 <xsl:if test=
"$useminipage='1'"><xsl:text>\end{minipage}
</xsl:text></xsl:if>
372 <xsl:template name="generate.col">
373 <xsl:param name="countcol">1</xsl:param>
377 <xsl:template match=
"colspec"></xsl:template>
378 <xsl:template match=
"spanspec"></xsl:template>
383 <xsl:template match=
"thead|tfoot">
384 <xsl:if test=
"@align">
385 <xsl:attribute name=
"align">
386 <xsl:value-of select=
"@align"/>
389 <xsl:if test=
"@char">
390 <xsl:attribute name=
"char">
391 <xsl:value-of select=
"@char"/>
394 <xsl:if test=
"@charoff">
395 <xsl:attribute name=
"charoff">
396 <xsl:value-of select=
"@charoff"/>
399 <xsl:if test=
"@valign">
400 <xsl:attribute name=
"valign">
401 <xsl:value-of select=
"@valign"/>
404 <xsl:apply-templates/>
407 <xsl:template match=
"thead/row/entry|tfoot/row/entry">
408 <xsl:call-template name=
"latex.entry.prealign"/>
409 <xsl:call-template name=
"latex.thead.row.entry"/>
410 <xsl:call-template name=
"latex.entry.postalign"/>
412 <xsl:when test=
"position()=last()"><xsl:text> \tabularnewline
</xsl:text></xsl:when>
413 <xsl:otherwise><xsl:call-template name=
"generate.latex.cell.separator"/></xsl:otherwise>
417 <xsl:template match=
"tbody">
418 <xsl:apply-templates/>
421 <xsl:template match=
"row">
422 <xsl:apply-templates/>
425 <xsl:template match=
"tbody/row|thead/row|tfoot/row">
426 <xsl:apply-templates/>
427 <!-- The rule below the last row in the table is controlled by the
428 Frame attribute of the enclosing Table or InformalTable and the RowSep
429 of the last row is ignored. If unspecified, this attribute is
430 inherited from enclosing elements, rowsep=1 by default. -->
431 <xsl:variable name=
"parent_position" select=
"count(../preceding-sibling::node())+1"/>
432 <xsl:variable name=
"grandparent_children" select=
"count(../../child::node())"/>
433 <xsl:if test=
"(count(@rowsep)=0 or @rowsep='1') and (position() != last() or $parent_position < $grandparent_children)">
434 <xsl:text> \hline
</xsl:text>
439 <xsl:template match=
"tbody/row/entry">
440 <xsl:call-template name=
"latex.entry.prealign"/>
441 <xsl:apply-templates/>
442 <xsl:call-template name=
"latex.entry.postalign"/>
444 <xsl:when test=
"position()=last()"><xsl:text> \tabularnewline
</xsl:text></xsl:when>
445 <xsl:otherwise><xsl:call-template name=
"generate.latex.cell.separator"/></xsl:otherwise>
450 <xsl:template name=
"latex.entry.prealign">
451 <xsl:variable name=
"span">
453 <xsl:when test=
"@spanname!=''">
454 <xsl:call-template name=
"calculate.colspan">
455 <xsl:with-param name=
"namest" select=
"../../../spanspec[@spanname=@spanname]/@namest"/>
456 <xsl:with-param name=
"nameend" select=
"../../../spanspec[@spanname=@spanname]/@nameend"/>
459 <xsl:when test=
"@namest!=''">
460 <xsl:call-template name=
"calculate.colspan"/>
462 <xsl:otherwise>-
1</xsl:otherwise>
465 <xsl:if test=
"$span > 1">
466 <xsl:text>\multicolumn{
</xsl:text>
467 <xsl:value-of select=
"$span"/>
468 <xsl:text>|}{
</xsl:text><!-- TODO take heed of @colsep -->
470 <xsl:when test=
"@align='left'"><xsl:text>l
</xsl:text></xsl:when>
471 <xsl:when test=
"@align='right'"><xsl:text>r
</xsl:text></xsl:when>
472 <xsl:when test=
"@align='center'"><xsl:text>c
</xsl:text></xsl:when>
473 <xsl:when test=
"@align='char'">c
<xsl:message>Table entry char alignment is not supported.
</xsl:message></xsl:when>
474 <xsl:otherwise>c
</xsl:otherwise>
476 <!-- use this as a hook for some general warnings -->
477 <xsl:text>}
</xsl:text>
479 <!-- this is used when the entry's align spec wants to override the column default -->
480 <xsl:if test=
"$span < 1">
482 <xsl:when test=
"@align='left'"><xsl:text>\docbooktolatexalignll
</xsl:text></xsl:when>
483 <xsl:when test=
"@align='right'"><xsl:text>\docbooktolatexalignrl
</xsl:text></xsl:when>
484 <xsl:when test=
"@align='center'"><xsl:text>\docbooktolatexaligncl
</xsl:text></xsl:when>
485 <xsl:when test=
"@align='char'"><xsl:message>Table entry char alignment is not supported.
</xsl:message></xsl:when>
488 <xsl:text>{
</xsl:text>
489 <xsl:if test=
"@rotate='1'">
490 <xsl:text>\rotatebox{
90}
</xsl:text>
491 <xsl:if test=
"@align!=''"><xsl:message>entry[@rotate='
1' and @align!=''] probably doesn't work.
</xsl:message></xsl:if>
493 <xsl:text>{
</xsl:text>
494 <!-- use this as a hook for some general warnings -->
495 <xsl:if test=
"@morerows!=''"><xsl:message>The morerows attribute is not supported.
</xsl:message></xsl:if>
498 <xsl:template name=
"latex.entry.postalign">
499 <xsl:text>}}
</xsl:text>
500 <!-- this is used when the entry's align spec wants to override the column default -->
501 <xsl:if test=
"@namest='' and @spanspec=''"><!-- TODO improve -->
503 <xsl:when test=
"@align='left'"><xsl:text>\docbooktolatexalignlr
</xsl:text></xsl:when>
504 <xsl:when test=
"@align='right'"><xsl:text>\docbooktolatexalignrr
</xsl:text></xsl:when>
505 <xsl:when test=
"@align='center'"><xsl:text>\docbooktolatexaligncr
</xsl:text></xsl:when>
522 <xsl:template name=
"process.cell">
523 <xsl:param name=
"cellgi">td
</xsl:param>
524 <xsl:variable name=
"empty.cell" select=
"count(node()) = 0"/>
526 <xsl:element name=
"{$cellgi}">
527 <xsl:if test=
"@morerows">
528 <xsl:attribute name=
"rowspan">
529 <xsl:value-of select=
"@morerows+1"/>
532 <xsl:if test=
"@namest">
533 <xsl:attribute name=
"colspan">
534 <xsl:call-template name=
"calculate.colspan"/>
537 <xsl:if test=
"@align">
538 <xsl:attribute name=
"align">
539 <xsl:value-of select=
"@align"/>
542 <xsl:if test=
"@char">
543 <xsl:attribute name=
"char">
544 <xsl:value-of select=
"@char"/>
547 <xsl:if test=
"@charoff">
548 <xsl:attribute name=
"charoff">
549 <xsl:value-of select=
"@charoff"/>
552 <xsl:if test=
"@valign">
553 <xsl:attribute name=
"valign">
554 <xsl:value-of select=
"@valign"/>
559 <xsl:when test=
"$empty.cell">
560 <xsl:text> </xsl:text>
563 <xsl:apply-templates/>
569 <xsl:template name=
"generate.colgroup">
570 <xsl:param name=
"cols" select=
"1"/>
571 <xsl:param name=
"count" select=
"1"/>
573 <xsl:when test=
"$count>$cols"></xsl:when>
575 <xsl:call-template name=
"generate.col">
576 <xsl:with-param name=
"countcol" select=
"$count"/>
578 <xsl:call-template name=
"generate.colgroup">
579 <xsl:with-param name=
"cols" select=
"$cols"/>
580 <xsl:with-param name=
"count" select=
"$count+1"/>
586 <xsl:template name=
"generate.col">
587 <xsl:param name=
"countcol">1</xsl:param>
588 <xsl:param name=
"colspecs" select=
"./colspec"/>
589 <xsl:param name=
"count">1</xsl:param>
590 <xsl:param name=
"colnum">1</xsl:param>
593 <xsl:when test=
"$count>count($colspecs)">
597 <xsl:variable name=
"colspec" select=
"$colspecs[$count=position()]"/>
598 <xsl:variable name=
"colspec.colnum">
600 <xsl:when test=
"$colspec/@colnum">
601 <xsl:value-of select=
"$colspec/@colnum"/>
604 <xsl:value-of select=
"$colnum"/>
610 <xsl:when test=
"$colspec.colnum=$countcol">
612 <xsl:if test=
"$colspec/@align">
613 <xsl:attribute name=
"align">
614 <xsl:value-of select=
"$colspec/@align"/>
617 <xsl:if test=
"$colspec/@char">
618 <xsl:attribute name=
"char">
619 <xsl:value-of select=
"$colspec/@char"/>
622 <xsl:if test=
"$colspec/@charoff">
623 <xsl:attribute name=
"charoff">
624 <xsl:value-of select=
"$colspec/@charoff"/>
630 <xsl:call-template name=
"generate.col">
631 <xsl:with-param name=
"countcol" select=
"$countcol"/>
632 <xsl:with-param name=
"colspecs" select=
"$colspecs"/>
633 <xsl:with-param name=
"count" select=
"$count+1"/>
634 <xsl:with-param name=
"colnum">
636 <xsl:when test=
"$colspec/@colnum">
637 <xsl:value-of select=
"$colspec/@colnum + 1"/>
640 <xsl:value-of select=
"$colnum + 1"/>
652 <xsl:template name=
"colspec.colnum">
653 <!-- when this macro is called, the current context must be an entry -->
654 <xsl:param name=
"colname"></xsl:param>
655 <!-- .. = row, ../.. = thead|tbody, ../../.. = tgroup -->
656 <xsl:param name=
"colspecs" select=
"../../../../tgroup/colspec"/>
657 <xsl:param name=
"count">1</xsl:param>
658 <xsl:param name=
"colnum">1</xsl:param>
660 <xsl:when test=
"$count>count($colspecs)"></xsl:when>
662 <xsl:variable name=
"colspec" select=
"$colspecs[$count=position()]"/>
664 <xsl:value-of select="$count"/>:
665 <xsl:value-of select="$colspec/@colname"/>=
666 <xsl:value-of select="$colnum"/>
669 <xsl:when test=
"$colspec/@colname=$colname">
671 <xsl:when test=
"$colspec/@colnum">
672 <xsl:value-of select=
"$colspec/@colnum"/>
675 <xsl:value-of select=
"$colnum"/>
680 <xsl:call-template name=
"colspec.colnum">
681 <xsl:with-param name=
"colname" select=
"$colname"/>
682 <xsl:with-param name=
"colspecs" select=
"$colspecs"/>
683 <xsl:with-param name=
"count" select=
"$count+1"/>
684 <xsl:with-param name=
"colnum">
686 <xsl:when test=
"$colspec/@colnum">
687 <xsl:value-of select=
"$colspec/@colnum + 1"/>
690 <xsl:value-of select=
"$colnum + 1"/>
701 <xsl:template name=
"colspec.colwidth">
702 <!-- when this macro is called, the current context must be an entry -->
703 <xsl:param name=
"colname"></xsl:param>
704 <!-- .. = row, ../.. = thead|tbody, ../../.. = tgroup -->
705 <xsl:param name=
"colspecs" select=
"../../../../tgroup/colspec"/>
706 <xsl:param name=
"count">1</xsl:param>
708 <xsl:when test=
"$count>count($colspecs)"></xsl:when>
710 <xsl:variable name=
"colspec" select=
"$colspecs[$count=position()]"/>
712 <xsl:when test=
"$colspec/@colname=$colname">
713 <xsl:value-of select=
"$colspec/@colwidth"/>
716 <xsl:call-template name=
"colspec.colwidth">
717 <xsl:with-param name=
"colname" select=
"$colname"/>
718 <xsl:with-param name=
"colspecs" select=
"$colspecs"/>
719 <xsl:with-param name=
"count" select=
"$count+1"/>
727 <xsl:template name=
"calculate.colspan">
728 <xsl:param name=
"namest" select=
"@namest"/>
729 <xsl:param name=
"nameend" select=
"@nameend"/>
730 <xsl:variable name=
"scol">
731 <xsl:call-template name=
"colspec.colnum">
732 <xsl:with-param name=
"colname" select=
"$namest"/>
735 <xsl:variable name=
"ecol">
736 <xsl:call-template name=
"colspec.colnum">
737 <xsl:with-param name=
"colname" select=
"$nameend"/>
740 <xsl:value-of select=
"$ecol - $scol + 1"/>