table.xsl 43 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177
  1. <?xml version="1.0" encoding="ASCII"?>
  2. <!--This file was created automatically by html2xhtml-->
  3. <!--from the HTML stylesheets.-->
  4. <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:doc="http://nwalsh.com/xsl/documentation/1.0" xmlns:stbl="http://nwalsh.com/xslt/ext/com.nwalsh.saxon.Table" xmlns:xtbl="xalan://com.nwalsh.xalan.Table" xmlns:lxslt="http://xml.apache.org/xslt" xmlns:ptbl="http://nwalsh.com/xslt/ext/xsltproc/python/Table" xmlns="http://www.w3.org/1999/xhtml" exclude-result-prefixes="doc stbl xtbl lxslt ptbl" version="1.0">
  5. <xsl:include href="../common/table.xsl"/>
  6. <!-- ********************************************************************
  7. $Id: table.xsl 9297 2012-04-22 03:56:16Z bobstayton $
  8. ********************************************************************
  9. This file is part of the XSL DocBook Stylesheet distribution.
  10. See ../README or http://docbook.sf.net/release/xsl/current/ for
  11. copyright and other information.
  12. ******************************************************************** -->
  13. <lxslt:component prefix="xtbl" functions="adjustColumnWidths"/>
  14. <xsl:template name="empty.table.cell">
  15. <xsl:param name="colnum" select="0"/>
  16. <xsl:variable name="rowsep">
  17. <xsl:choose>
  18. <!-- If this is the last row, rowsep never applies. -->
  19. <xsl:when test="not(ancestor-or-self::row[1]/following-sibling::row or ancestor-or-self::thead/following-sibling::tbody or ancestor-or-self::tbody/preceding-sibling::tfoot)">
  20. <xsl:value-of select="0"/>
  21. </xsl:when>
  22. <xsl:otherwise>
  23. <xsl:call-template name="inherited.table.attribute">
  24. <xsl:with-param name="entry" select="NOT-AN-ELEMENT-NAME"/>
  25. <xsl:with-param name="row" select="ancestor-or-self::row[1]"/>
  26. <xsl:with-param name="colnum" select="$colnum"/>
  27. <xsl:with-param name="attribute" select="'rowsep'"/>
  28. </xsl:call-template>
  29. </xsl:otherwise>
  30. </xsl:choose>
  31. </xsl:variable>
  32. <xsl:variable name="colsep">
  33. <xsl:choose>
  34. <!-- If this is the last column, colsep never applies. -->
  35. <xsl:when test="number($colnum) &gt;= ancestor::tgroup/@cols">0</xsl:when>
  36. <xsl:otherwise>
  37. <xsl:call-template name="inherited.table.attribute">
  38. <xsl:with-param name="entry" select="NOT-AN-ELEMENT-NAME"/>
  39. <xsl:with-param name="row" select="ancestor-or-self::row[1]"/>
  40. <xsl:with-param name="colnum" select="$colnum"/>
  41. <xsl:with-param name="attribute" select="'colsep'"/>
  42. </xsl:call-template>
  43. </xsl:otherwise>
  44. </xsl:choose>
  45. </xsl:variable>
  46. <td class="auto-generated">
  47. <xsl:if test="$table.borders.with.css != 0">
  48. <xsl:attribute name="style">
  49. <xsl:if test="$colsep &gt; 0">
  50. <xsl:call-template name="border">
  51. <xsl:with-param name="side" select="'right'"/>
  52. </xsl:call-template>
  53. </xsl:if>
  54. <xsl:if test="$rowsep &gt; 0">
  55. <xsl:call-template name="border">
  56. <xsl:with-param name="side" select="'bottom'"/>
  57. </xsl:call-template>
  58. </xsl:if>
  59. </xsl:attribute>
  60. </xsl:if>
  61. <xsl:text>&#160;</xsl:text>
  62. </td>
  63. </xsl:template>
  64. <!-- ==================================================================== -->
  65. <xsl:template name="border">
  66. <xsl:param name="side" select="'left'"/>
  67. <xsl:param name="padding" select="0"/>
  68. <xsl:param name="style" select="$table.cell.border.style"/>
  69. <xsl:param name="color" select="$table.cell.border.color"/>
  70. <xsl:param name="thickness" select="$table.cell.border.thickness"/>
  71. <!-- Note: Some browsers (mozilla) require at least a width and style. -->
  72. <xsl:choose>
  73. <xsl:when test="($thickness != '' and $style != '' and $color != '') or ($thickness != '' and $style != '') or ($thickness != '')">
  74. <!-- use the compound property if we can: -->
  75. <!-- it saves space and probably works more reliably -->
  76. <xsl:text>border-</xsl:text>
  77. <xsl:value-of select="$side"/>
  78. <xsl:text>: </xsl:text>
  79. <xsl:value-of select="$thickness"/>
  80. <xsl:text> </xsl:text>
  81. <xsl:value-of select="$style"/>
  82. <xsl:text> </xsl:text>
  83. <xsl:value-of select="$color"/>
  84. <xsl:text>; </xsl:text>
  85. </xsl:when>
  86. <xsl:otherwise>
  87. <!-- we need to specify the styles individually -->
  88. <xsl:if test="$thickness != ''">
  89. <xsl:text>border-</xsl:text>
  90. <xsl:value-of select="$side"/>
  91. <xsl:text>-width: </xsl:text>
  92. <xsl:value-of select="$thickness"/>
  93. <xsl:text>; </xsl:text>
  94. </xsl:if>
  95. <xsl:if test="$style != ''">
  96. <xsl:text>border-</xsl:text>
  97. <xsl:value-of select="$side"/>
  98. <xsl:text>-style: </xsl:text>
  99. <xsl:value-of select="$style"/>
  100. <xsl:text>; </xsl:text>
  101. </xsl:if>
  102. <xsl:if test="$color != ''">
  103. <xsl:text>border-</xsl:text>
  104. <xsl:value-of select="$side"/>
  105. <xsl:text>-color: </xsl:text>
  106. <xsl:value-of select="$color"/>
  107. <xsl:text>; </xsl:text>
  108. </xsl:if>
  109. </xsl:otherwise>
  110. </xsl:choose>
  111. </xsl:template>
  112. <!-- ==================================================================== -->
  113. <xsl:template match="tgroup" name="tgroup">
  114. <xsl:if test="not(@cols) or @cols = '' or string(number(@cols)) = 'NaN'">
  115. <xsl:message terminate="yes">
  116. <xsl:text>Error: CALS tables must specify the number of columns.</xsl:text>
  117. </xsl:message>
  118. </xsl:if>
  119. <xsl:variable name="summary">
  120. <xsl:call-template name="pi.dbhtml_table-summary"/>
  121. </xsl:variable>
  122. <xsl:variable name="cellspacing">
  123. <xsl:call-template name="pi.dbhtml_cellspacing"/>
  124. </xsl:variable>
  125. <xsl:variable name="cellpadding">
  126. <xsl:call-template name="pi.dbhtml_cellpadding"/>
  127. </xsl:variable>
  128. <table>
  129. <xsl:choose>
  130. <!-- If there's a textobject/phrase for the table summary, use it -->
  131. <xsl:when test="../textobject/phrase">
  132. <xsl:attribute name="summary">
  133. <xsl:value-of select="../textobject/phrase"/>
  134. </xsl:attribute>
  135. </xsl:when>
  136. <!-- If there's a <?dbhtml table-summary="foo"?> PI, use it for
  137. the HTML table summary attribute -->
  138. <xsl:when test="$summary != ''">
  139. <xsl:attribute name="summary">
  140. <xsl:value-of select="$summary"/>
  141. </xsl:attribute>
  142. </xsl:when>
  143. <!-- Otherwise, if there's a title, use that -->
  144. <xsl:when test="../title">
  145. <xsl:attribute name="summary">
  146. <!-- This screws up on inline markup and footnotes, oh well... -->
  147. <xsl:value-of select="string(../title)"/>
  148. </xsl:attribute>
  149. </xsl:when>
  150. <!-- Otherwise, forget the whole idea -->
  151. <xsl:otherwise><!-- nevermind --></xsl:otherwise>
  152. </xsl:choose>
  153. <xsl:if test="$cellspacing != '' or $html.cellspacing != ''">
  154. <xsl:attribute name="cellspacing">
  155. <xsl:choose>
  156. <xsl:when test="$cellspacing != ''">
  157. <xsl:value-of select="$cellspacing"/>
  158. </xsl:when>
  159. <xsl:otherwise>
  160. <xsl:value-of select="$html.cellspacing"/>
  161. </xsl:otherwise>
  162. </xsl:choose>
  163. </xsl:attribute>
  164. </xsl:if>
  165. <xsl:if test="$cellpadding != '' or $html.cellpadding != ''">
  166. <xsl:attribute name="cellpadding">
  167. <xsl:choose>
  168. <xsl:when test="$cellpadding != ''">
  169. <xsl:value-of select="$cellpadding"/>
  170. </xsl:when>
  171. <xsl:otherwise>
  172. <xsl:value-of select="$html.cellpadding"/>
  173. </xsl:otherwise>
  174. </xsl:choose>
  175. </xsl:attribute>
  176. </xsl:if>
  177. <xsl:if test="../@pgwide=1 or local-name(.) = 'entrytbl'">
  178. <xsl:attribute name="width">100%</xsl:attribute>
  179. </xsl:if>
  180. <xsl:choose>
  181. <xsl:when test="$table.borders.with.css != 0">
  182. <xsl:choose>
  183. <xsl:when test="../@frame='all' or (not(../@frame) and $default.table.frame='all')">
  184. <xsl:attribute name="style">
  185. <xsl:text>border-collapse: collapse;</xsl:text>
  186. <xsl:call-template name="border">
  187. <xsl:with-param name="side" select="'top'"/>
  188. <xsl:with-param name="style" select="$table.frame.border.style"/>
  189. <xsl:with-param name="color" select="$table.frame.border.color"/>
  190. <xsl:with-param name="thickness" select="$table.frame.border.thickness"/>
  191. </xsl:call-template>
  192. <xsl:call-template name="border">
  193. <xsl:with-param name="side" select="'bottom'"/>
  194. <xsl:with-param name="style" select="$table.frame.border.style"/>
  195. <xsl:with-param name="color" select="$table.frame.border.color"/>
  196. <xsl:with-param name="thickness" select="$table.frame.border.thickness"/>
  197. </xsl:call-template>
  198. <xsl:call-template name="border">
  199. <xsl:with-param name="side" select="'left'"/>
  200. <xsl:with-param name="style" select="$table.frame.border.style"/>
  201. <xsl:with-param name="color" select="$table.frame.border.color"/>
  202. <xsl:with-param name="thickness" select="$table.frame.border.thickness"/>
  203. </xsl:call-template>
  204. <xsl:call-template name="border">
  205. <xsl:with-param name="side" select="'right'"/>
  206. <xsl:with-param name="style" select="$table.frame.border.style"/>
  207. <xsl:with-param name="color" select="$table.frame.border.color"/>
  208. <xsl:with-param name="thickness" select="$table.frame.border.thickness"/>
  209. </xsl:call-template>
  210. </xsl:attribute>
  211. </xsl:when>
  212. <xsl:when test="../@frame='topbot' or (not(../@frame) and $default.table.frame='topbot')">
  213. <xsl:attribute name="style">
  214. <xsl:text>border-collapse: collapse;</xsl:text>
  215. <xsl:call-template name="border">
  216. <xsl:with-param name="side" select="'top'"/>
  217. <xsl:with-param name="style" select="$table.frame.border.style"/>
  218. <xsl:with-param name="color" select="$table.frame.border.color"/>
  219. <xsl:with-param name="thickness" select="$table.frame.border.thickness"/>
  220. </xsl:call-template>
  221. <xsl:call-template name="border">
  222. <xsl:with-param name="side" select="'bottom'"/>
  223. <xsl:with-param name="style" select="$table.frame.border.style"/>
  224. <xsl:with-param name="color" select="$table.frame.border.color"/>
  225. <xsl:with-param name="thickness" select="$table.frame.border.thickness"/>
  226. </xsl:call-template>
  227. </xsl:attribute>
  228. </xsl:when>
  229. <xsl:when test="../@frame='top' or (not(../@frame) and $default.table.frame='top')">
  230. <xsl:attribute name="style">
  231. <xsl:text>border-collapse: collapse;</xsl:text>
  232. <xsl:call-template name="border">
  233. <xsl:with-param name="side" select="'top'"/>
  234. <xsl:with-param name="style" select="$table.frame.border.style"/>
  235. <xsl:with-param name="color" select="$table.frame.border.color"/>
  236. <xsl:with-param name="thickness" select="$table.frame.border.thickness"/>
  237. </xsl:call-template>
  238. </xsl:attribute>
  239. </xsl:when>
  240. <xsl:when test="../@frame='bottom' or (not(../@frame) and $default.table.frame='bottom')">
  241. <xsl:attribute name="style">
  242. <xsl:text>border-collapse: collapse;</xsl:text>
  243. <xsl:call-template name="border">
  244. <xsl:with-param name="side" select="'bottom'"/>
  245. <xsl:with-param name="style" select="$table.frame.border.style"/>
  246. <xsl:with-param name="color" select="$table.frame.border.color"/>
  247. <xsl:with-param name="thickness" select="$table.frame.border.thickness"/>
  248. </xsl:call-template>
  249. </xsl:attribute>
  250. </xsl:when>
  251. <xsl:when test="../@frame='sides' or (not(../@frame) and $default.table.frame='sides')">
  252. <xsl:attribute name="style">
  253. <xsl:text>border-collapse: collapse;</xsl:text>
  254. <xsl:call-template name="border">
  255. <xsl:with-param name="side" select="'left'"/>
  256. <xsl:with-param name="style" select="$table.frame.border.style"/>
  257. <xsl:with-param name="color" select="$table.frame.border.color"/>
  258. <xsl:with-param name="thickness" select="$table.frame.border.thickness"/>
  259. </xsl:call-template>
  260. <xsl:call-template name="border">
  261. <xsl:with-param name="side" select="'right'"/>
  262. <xsl:with-param name="style" select="$table.frame.border.style"/>
  263. <xsl:with-param name="color" select="$table.frame.border.color"/>
  264. <xsl:with-param name="thickness" select="$table.frame.border.thickness"/>
  265. </xsl:call-template>
  266. </xsl:attribute>
  267. </xsl:when>
  268. <xsl:when test="../@frame='none'">
  269. <xsl:attribute name="style">
  270. <xsl:text>border: none;</xsl:text>
  271. </xsl:attribute>
  272. </xsl:when>
  273. <xsl:otherwise>
  274. <xsl:attribute name="style">
  275. <xsl:text>border-collapse: collapse;</xsl:text>
  276. </xsl:attribute>
  277. </xsl:otherwise>
  278. </xsl:choose>
  279. </xsl:when>
  280. <xsl:when test="../@frame='none' or (not(../@frame) and $default.table.frame='none') or local-name(.) = 'entrytbl'">
  281. <xsl:attribute name="border">0</xsl:attribute>
  282. </xsl:when>
  283. <xsl:otherwise>
  284. <xsl:attribute name="border">1</xsl:attribute>
  285. </xsl:otherwise>
  286. </xsl:choose>
  287. <xsl:variable name="colgroup">
  288. <colgroup>
  289. <xsl:call-template name="generate.colgroup">
  290. <xsl:with-param name="cols" select="@cols"/>
  291. </xsl:call-template>
  292. </colgroup>
  293. </xsl:variable>
  294. <xsl:variable name="explicit.table.width">
  295. <xsl:call-template name="pi.dbhtml_table-width">
  296. <xsl:with-param name="node" select=".."/>
  297. </xsl:call-template>
  298. </xsl:variable>
  299. <xsl:variable name="table.width">
  300. <xsl:choose>
  301. <xsl:when test="$explicit.table.width != ''">
  302. <xsl:value-of select="$explicit.table.width"/>
  303. </xsl:when>
  304. <xsl:when test="$default.table.width = ''">
  305. <xsl:text>100%</xsl:text>
  306. </xsl:when>
  307. <xsl:otherwise>
  308. <xsl:value-of select="$default.table.width"/>
  309. </xsl:otherwise>
  310. </xsl:choose>
  311. </xsl:variable>
  312. <xsl:if test="$default.table.width != '' or $explicit.table.width != ''">
  313. <xsl:attribute name="width">
  314. <xsl:choose>
  315. <xsl:when test="contains($table.width, '%')">
  316. <xsl:value-of select="$table.width"/>
  317. </xsl:when>
  318. <xsl:when test="$use.extensions != 0 and $tablecolumns.extension != 0">
  319. <xsl:choose>
  320. <xsl:when test="function-available('stbl:convertLength')">
  321. <xsl:value-of select="stbl:convertLength($table.width)"/>
  322. </xsl:when>
  323. <xsl:when test="function-available('xtbl:convertLength')">
  324. <xsl:value-of select="xtbl:convertLength($table.width)"/>
  325. </xsl:when>
  326. <xsl:otherwise>
  327. <xsl:message terminate="yes">
  328. <xsl:text>No convertLength function available.</xsl:text>
  329. </xsl:message>
  330. </xsl:otherwise>
  331. </xsl:choose>
  332. </xsl:when>
  333. <xsl:otherwise>
  334. <xsl:value-of select="$table.width"/>
  335. </xsl:otherwise>
  336. </xsl:choose>
  337. </xsl:attribute>
  338. </xsl:if>
  339. <xsl:choose>
  340. <xsl:when test="$use.extensions != 0 and $tablecolumns.extension != 0">
  341. <xsl:choose>
  342. <xsl:when test="function-available('stbl:adjustColumnWidths')">
  343. <xsl:copy-of select="stbl:adjustColumnWidths($colgroup)"/>
  344. </xsl:when>
  345. <xsl:when test="function-available('xtbl:adjustColumnWidths')">
  346. <xsl:copy-of select="xtbl:adjustColumnWidths($colgroup)"/>
  347. </xsl:when>
  348. <xsl:when test="function-available('ptbl:adjustColumnWidths')">
  349. <xsl:copy-of select="ptbl:adjustColumnWidths($colgroup)"/>
  350. </xsl:when>
  351. <xsl:otherwise>
  352. <xsl:message terminate="yes">
  353. <xsl:text>No adjustColumnWidths function available.</xsl:text>
  354. </xsl:message>
  355. </xsl:otherwise>
  356. </xsl:choose>
  357. </xsl:when>
  358. <xsl:otherwise>
  359. <xsl:copy-of select="$colgroup"/>
  360. </xsl:otherwise>
  361. </xsl:choose>
  362. <xsl:apply-templates select="thead"/>
  363. <xsl:apply-templates select="tfoot"/>
  364. <xsl:apply-templates select="tbody"/>
  365. <xsl:if test=".//footnote|../title//footnote">
  366. <tbody class="footnotes">
  367. <tr>
  368. <td colspan="{@cols}">
  369. <xsl:apply-templates select=".//footnote|../title//footnote" mode="table.footnote.mode"/>
  370. </td>
  371. </tr>
  372. </tbody>
  373. </xsl:if>
  374. </table>
  375. </xsl:template>
  376. <xsl:template match="tgroup/processing-instruction('dbhtml')">
  377. <xsl:variable name="summary">
  378. <xsl:call-template name="pi.dbhtml_table-summary"/>
  379. </xsl:variable>
  380. <!-- Suppress the table-summary PI -->
  381. <xsl:if test="$summary = ''">
  382. <xsl:processing-instruction name="dbhtml">
  383. <xsl:value-of select="."/>
  384. </xsl:processing-instruction>
  385. </xsl:if>
  386. </xsl:template>
  387. <xsl:template match="colspec"/>
  388. <xsl:template match="spanspec"/>
  389. <xsl:template match="thead|tfoot">
  390. <xsl:element name="{local-name(.)}" namespace="http://www.w3.org/1999/xhtml">
  391. <xsl:if test="@align">
  392. <xsl:attribute name="align">
  393. <xsl:value-of select="@align"/>
  394. </xsl:attribute>
  395. </xsl:if>
  396. <xsl:if test="@char">
  397. <xsl:attribute name="char">
  398. <xsl:value-of select="@char"/>
  399. </xsl:attribute>
  400. </xsl:if>
  401. <xsl:if test="@charoff">
  402. <xsl:attribute name="charoff">
  403. <xsl:value-of select="@charoff"/>
  404. </xsl:attribute>
  405. </xsl:if>
  406. <xsl:if test="@valign">
  407. <xsl:attribute name="valign">
  408. <xsl:value-of select="@valign"/>
  409. </xsl:attribute>
  410. </xsl:if>
  411. <xsl:choose>
  412. <!-- recurse on rows only if @morerows is present -->
  413. <xsl:when test="row/entry/@morerows|row/entrytbl/@morerows">
  414. <xsl:apply-templates select="row[1]">
  415. <xsl:with-param name="spans">
  416. <xsl:call-template name="blank.spans">
  417. <xsl:with-param name="cols" select="../@cols"/>
  418. </xsl:call-template>
  419. </xsl:with-param>
  420. <xsl:with-param name="browserows" select="'recurse'"/>
  421. </xsl:apply-templates>
  422. </xsl:when>
  423. <xsl:otherwise>
  424. <xsl:apply-templates select="row">
  425. <xsl:with-param name="spans">
  426. <xsl:call-template name="blank.spans">
  427. <xsl:with-param name="cols" select="../@cols"/>
  428. </xsl:call-template>
  429. </xsl:with-param>
  430. <xsl:with-param name="browserows" select="'loop'"/>
  431. </xsl:apply-templates>
  432. </xsl:otherwise>
  433. </xsl:choose>
  434. </xsl:element>
  435. </xsl:template>
  436. <xsl:template match="tbody">
  437. <tbody>
  438. <xsl:if test="@align">
  439. <xsl:attribute name="align">
  440. <xsl:value-of select="@align"/>
  441. </xsl:attribute>
  442. </xsl:if>
  443. <xsl:if test="@char">
  444. <xsl:attribute name="char">
  445. <xsl:value-of select="@char"/>
  446. </xsl:attribute>
  447. </xsl:if>
  448. <xsl:if test="@charoff">
  449. <xsl:attribute name="charoff">
  450. <xsl:value-of select="@charoff"/>
  451. </xsl:attribute>
  452. </xsl:if>
  453. <xsl:if test="@valign">
  454. <xsl:attribute name="valign">
  455. <xsl:value-of select="@valign"/>
  456. </xsl:attribute>
  457. </xsl:if>
  458. <xsl:choose>
  459. <xsl:when test="row/entry/@morerows|row/entrytbl/@morerows">
  460. <xsl:apply-templates select="row[1]">
  461. <xsl:with-param name="spans">
  462. <xsl:call-template name="blank.spans">
  463. <xsl:with-param name="cols" select="../@cols"/>
  464. </xsl:call-template>
  465. </xsl:with-param>
  466. <xsl:with-param name="browserows" select="'recurse'"/>
  467. </xsl:apply-templates>
  468. </xsl:when>
  469. <xsl:otherwise>
  470. <xsl:apply-templates select="row">
  471. <xsl:with-param name="spans">
  472. <xsl:call-template name="blank.spans">
  473. <xsl:with-param name="cols" select="../@cols"/>
  474. </xsl:call-template>
  475. </xsl:with-param>
  476. <xsl:with-param name="browserows" select="'loop'"/>
  477. </xsl:apply-templates>
  478. </xsl:otherwise>
  479. </xsl:choose>
  480. </tbody>
  481. </xsl:template>
  482. <xsl:template match="row">
  483. <xsl:param name="spans"/>
  484. <xsl:param name="browserows"/>
  485. <xsl:choose>
  486. <xsl:when test="contains($spans, '0')">
  487. <xsl:call-template name="normal-row">
  488. <xsl:with-param name="spans" select="$spans"/>
  489. <xsl:with-param name="browserows" select="$browserows"/>
  490. </xsl:call-template>
  491. </xsl:when>
  492. <xsl:otherwise>
  493. <!--
  494. <xsl:message>
  495. <xsl:text>Ignoring row: </xsl:text>
  496. <xsl:value-of select="$spans"/>
  497. <xsl:text> = </xsl:text>
  498. <xsl:call-template name="consume-row">
  499. <xsl:with-param name="spans" select="$spans"/>
  500. </xsl:call-template>
  501. </xsl:message>
  502. -->
  503. <xsl:if test="normalize-space(.//text()) != ''">
  504. <xsl:message>Warning: overlapped row contains content!</xsl:message>
  505. </xsl:if>
  506. <tr><xsl:comment> This row intentionally left blank </xsl:comment></tr>
  507. <xsl:if test="$browserows = 'recurse'">
  508. <xsl:apply-templates select="following-sibling::row[1]">
  509. <xsl:with-param name="spans">
  510. <xsl:call-template name="consume-row">
  511. <xsl:with-param name="spans" select="$spans"/>
  512. </xsl:call-template>
  513. </xsl:with-param>
  514. <xsl:with-param name="browserows" select="$browserows"/>
  515. </xsl:apply-templates>
  516. </xsl:if>
  517. </xsl:otherwise>
  518. </xsl:choose>
  519. </xsl:template>
  520. <xsl:template name="normal-row">
  521. <xsl:param name="spans"/>
  522. <xsl:param name="browserows"/>
  523. <xsl:variable name="row-height">
  524. <xsl:if test="processing-instruction('dbhtml')">
  525. <xsl:call-template name="pi.dbhtml_row-height"/>
  526. </xsl:if>
  527. </xsl:variable>
  528. <xsl:variable name="bgcolor">
  529. <xsl:if test="processing-instruction('dbhtml')">
  530. <xsl:call-template name="pi.dbhtml_bgcolor"/>
  531. </xsl:if>
  532. </xsl:variable>
  533. <xsl:variable name="class">
  534. <xsl:if test="processing-instruction('dbhtml')">
  535. <xsl:call-template name="pi.dbhtml_class"/>
  536. </xsl:if>
  537. </xsl:variable>
  538. <tr>
  539. <xsl:call-template name="id.attribute"/>
  540. <xsl:call-template name="tr.attributes">
  541. <xsl:with-param name="rownum">
  542. <xsl:number from="tgroup" count="row"/>
  543. </xsl:with-param>
  544. </xsl:call-template>
  545. <xsl:if test="$row-height != ''">
  546. <xsl:attribute name="height">
  547. <xsl:value-of select="$row-height"/>
  548. </xsl:attribute>
  549. </xsl:if>
  550. <xsl:if test="$bgcolor != ''">
  551. <xsl:attribute name="bgcolor">
  552. <xsl:value-of select="$bgcolor"/>
  553. </xsl:attribute>
  554. </xsl:if>
  555. <xsl:if test="$class != ''">
  556. <xsl:attribute name="class">
  557. <xsl:value-of select="$class"/>
  558. </xsl:attribute>
  559. </xsl:if>
  560. <xsl:if test="$table.borders.with.css != 0">
  561. <xsl:if test="@rowsep = 1 and following-sibling::row">
  562. <xsl:attribute name="style">
  563. <xsl:call-template name="border">
  564. <xsl:with-param name="side" select="'bottom'"/>
  565. </xsl:call-template>
  566. </xsl:attribute>
  567. </xsl:if>
  568. </xsl:if>
  569. <xsl:if test="@align">
  570. <xsl:attribute name="align">
  571. <xsl:value-of select="@align"/>
  572. </xsl:attribute>
  573. </xsl:if>
  574. <xsl:if test="@char">
  575. <xsl:attribute name="char">
  576. <xsl:value-of select="@char"/>
  577. </xsl:attribute>
  578. </xsl:if>
  579. <xsl:if test="@charoff">
  580. <xsl:attribute name="charoff">
  581. <xsl:value-of select="@charoff"/>
  582. </xsl:attribute>
  583. </xsl:if>
  584. <xsl:if test="@valign">
  585. <xsl:attribute name="valign">
  586. <xsl:value-of select="@valign"/>
  587. </xsl:attribute>
  588. </xsl:if>
  589. <xsl:apply-templates select="(entry|entrytbl)[1]">
  590. <xsl:with-param name="spans" select="$spans"/>
  591. </xsl:apply-templates>
  592. </tr>
  593. <xsl:if test="$browserows = 'recurse'">
  594. <xsl:if test="following-sibling::row">
  595. <xsl:variable name="nextspans">
  596. <xsl:apply-templates select="(entry|entrytbl)[1]" mode="span">
  597. <xsl:with-param name="spans" select="$spans"/>
  598. </xsl:apply-templates>
  599. </xsl:variable>
  600. <xsl:apply-templates select="following-sibling::row[1]">
  601. <xsl:with-param name="spans" select="$nextspans"/>
  602. <xsl:with-param name="browserows" select="$browserows"/>
  603. </xsl:apply-templates>
  604. </xsl:if>
  605. </xsl:if>
  606. </xsl:template>
  607. <xsl:template match="entry|entrytbl" name="entry">
  608. <xsl:param name="col">
  609. <xsl:choose>
  610. <xsl:when test="@revisionflag">
  611. <xsl:number from="row"/>
  612. </xsl:when>
  613. <xsl:otherwise>1</xsl:otherwise>
  614. </xsl:choose>
  615. </xsl:param>
  616. <xsl:param name="spans"/>
  617. <xsl:variable name="cellgi">
  618. <xsl:choose>
  619. <xsl:when test="ancestor::thead">th</xsl:when>
  620. <xsl:when test="ancestor::tfoot">th</xsl:when>
  621. <xsl:when test="ancestor::tbody and (ancestor::table[@rowheader = 'firstcol'] or ancestor::informaltable[@rowheader = 'firstcol']) and ancestor-or-self::entry[1][count(preceding-sibling::entry) = 0]">
  622. <xsl:text>th</xsl:text>
  623. </xsl:when>
  624. <xsl:otherwise>td</xsl:otherwise>
  625. </xsl:choose>
  626. </xsl:variable>
  627. <xsl:variable name="empty.cell" select="count(node()) = 0"/>
  628. <xsl:variable name="named.colnum">
  629. <xsl:call-template name="entry.colnum"/>
  630. </xsl:variable>
  631. <xsl:variable name="entry.colnum">
  632. <xsl:choose>
  633. <xsl:when test="$named.colnum &gt; 0">
  634. <xsl:value-of select="$named.colnum"/>
  635. </xsl:when>
  636. <xsl:otherwise>
  637. <xsl:value-of select="$col"/>
  638. </xsl:otherwise>
  639. </xsl:choose>
  640. </xsl:variable>
  641. <xsl:variable name="entry.colspan">
  642. <xsl:choose>
  643. <xsl:when test="@spanname or @namest">
  644. <xsl:call-template name="calculate.colspan"/>
  645. </xsl:when>
  646. <xsl:otherwise>1</xsl:otherwise>
  647. </xsl:choose>
  648. </xsl:variable>
  649. <xsl:variable name="following.spans">
  650. <xsl:call-template name="calculate.following.spans">
  651. <xsl:with-param name="colspan" select="$entry.colspan"/>
  652. <xsl:with-param name="spans" select="$spans"/>
  653. </xsl:call-template>
  654. </xsl:variable>
  655. <xsl:variable name="rowsep">
  656. <xsl:choose>
  657. <!-- If this is the last row, rowsep never applies. -->
  658. <xsl:when test="ancestor::entrytbl and not (ancestor-or-self::row[1]/following-sibling::row) and not (ancestor::thead)">
  659. <xsl:value-of select="0"/>
  660. </xsl:when>
  661. <xsl:when test="not(ancestor-or-self::row[1]/following-sibling::row or ancestor-or-self::thead/following-sibling::tbody or ancestor-or-self::tbody/preceding-sibling::tfoot)">
  662. <xsl:value-of select="0"/>
  663. </xsl:when>
  664. <xsl:when test="@morerows and not(@morerows &lt; count(ancestor-or-self::row[1]/following-sibling::row))">
  665. <xsl:value-of select="0"/>
  666. </xsl:when>
  667. <xsl:otherwise>
  668. <xsl:call-template name="inherited.table.attribute">
  669. <xsl:with-param name="entry" select="."/>
  670. <xsl:with-param name="colnum" select="$entry.colnum"/>
  671. <xsl:with-param name="attribute" select="'rowsep'"/>
  672. </xsl:call-template>
  673. </xsl:otherwise>
  674. </xsl:choose>
  675. </xsl:variable>
  676. <xsl:variable name="colsep">
  677. <xsl:choose>
  678. <!-- If this is the last column, colsep never applies. -->
  679. <xsl:when test="$following.spans = ''">0</xsl:when>
  680. <xsl:otherwise>
  681. <xsl:call-template name="inherited.table.attribute">
  682. <xsl:with-param name="entry" select="."/>
  683. <xsl:with-param name="colnum" select="$entry.colnum"/>
  684. <xsl:with-param name="attribute" select="'colsep'"/>
  685. </xsl:call-template>
  686. </xsl:otherwise>
  687. </xsl:choose>
  688. </xsl:variable>
  689. <xsl:variable name="valign">
  690. <xsl:call-template name="inherited.table.attribute">
  691. <xsl:with-param name="entry" select="."/>
  692. <xsl:with-param name="colnum" select="$entry.colnum"/>
  693. <xsl:with-param name="attribute" select="'valign'"/>
  694. </xsl:call-template>
  695. </xsl:variable>
  696. <xsl:variable name="align">
  697. <xsl:call-template name="inherited.table.attribute">
  698. <xsl:with-param name="entry" select="."/>
  699. <xsl:with-param name="colnum" select="$entry.colnum"/>
  700. <xsl:with-param name="attribute" select="'align'"/>
  701. </xsl:call-template>
  702. </xsl:variable>
  703. <xsl:variable name="char">
  704. <xsl:call-template name="inherited.table.attribute">
  705. <xsl:with-param name="entry" select="."/>
  706. <xsl:with-param name="colnum" select="$entry.colnum"/>
  707. <xsl:with-param name="attribute" select="'char'"/>
  708. </xsl:call-template>
  709. </xsl:variable>
  710. <xsl:variable name="charoff">
  711. <xsl:call-template name="inherited.table.attribute">
  712. <xsl:with-param name="entry" select="."/>
  713. <xsl:with-param name="colnum" select="$entry.colnum"/>
  714. <xsl:with-param name="attribute" select="'charoff'"/>
  715. </xsl:call-template>
  716. </xsl:variable>
  717. <xsl:choose>
  718. <xsl:when test="$spans != '' and not(starts-with($spans,'0:'))">
  719. <xsl:call-template name="entry">
  720. <xsl:with-param name="col" select="$col+1"/>
  721. <xsl:with-param name="spans" select="substring-after($spans,':')"/>
  722. </xsl:call-template>
  723. </xsl:when>
  724. <xsl:when test="number($entry.colnum) &gt; $col">
  725. <xsl:call-template name="empty.table.cell"/>
  726. <xsl:call-template name="entry">
  727. <xsl:with-param name="col" select="$col+1"/>
  728. <xsl:with-param name="spans" select="substring-after($spans,':')"/>
  729. </xsl:call-template>
  730. </xsl:when>
  731. <xsl:otherwise>
  732. <xsl:variable name="bgcolor">
  733. <xsl:if test="processing-instruction('dbhtml')">
  734. <xsl:call-template name="pi.dbhtml_bgcolor"/>
  735. </xsl:if>
  736. </xsl:variable>
  737. <xsl:element name="{$cellgi}" namespace="http://www.w3.org/1999/xhtml">
  738. <xsl:call-template name="id.attribute"/>
  739. <xsl:if test="$bgcolor != ''">
  740. <xsl:attribute name="bgcolor">
  741. <xsl:value-of select="$bgcolor"/>
  742. </xsl:attribute>
  743. </xsl:if>
  744. <xsl:call-template name="locale.html.attributes"/>
  745. <xsl:choose>
  746. <xsl:when test="$entry.propagates.style != 0 and @role">
  747. <xsl:apply-templates select="." mode="class.attribute">
  748. <xsl:with-param name="class" select="@role"/>
  749. </xsl:apply-templates>
  750. </xsl:when>
  751. <xsl:otherwise>
  752. <xsl:apply-templates select="." mode="class.attribute">
  753. <xsl:with-param name="class" select="''"/>
  754. </xsl:apply-templates>
  755. </xsl:otherwise>
  756. </xsl:choose>
  757. <xsl:if test="$show.revisionflag and @revisionflag">
  758. <xsl:attribute name="class">
  759. <xsl:value-of select="@revisionflag"/>
  760. </xsl:attribute>
  761. </xsl:if>
  762. <xsl:if test="$table.borders.with.css != 0">
  763. <xsl:attribute name="style">
  764. <xsl:if test="$colsep &gt; 0">
  765. <xsl:call-template name="border">
  766. <xsl:with-param name="side" select="'right'"/>
  767. </xsl:call-template>
  768. </xsl:if>
  769. <xsl:if test="$rowsep &gt; 0">
  770. <xsl:call-template name="border">
  771. <xsl:with-param name="side" select="'bottom'"/>
  772. </xsl:call-template>
  773. </xsl:if>
  774. </xsl:attribute>
  775. </xsl:if>
  776. <xsl:if test="@morerows &gt; 0">
  777. <xsl:attribute name="rowspan">
  778. <xsl:value-of select="1+@morerows"/>
  779. </xsl:attribute>
  780. </xsl:if>
  781. <xsl:if test="$entry.colspan &gt; 1">
  782. <xsl:attribute name="colspan">
  783. <xsl:value-of select="$entry.colspan"/>
  784. </xsl:attribute>
  785. </xsl:if>
  786. <xsl:if test="$align != ''">
  787. <xsl:attribute name="align">
  788. <xsl:value-of select="$align"/>
  789. </xsl:attribute>
  790. </xsl:if>
  791. <xsl:if test="$valign != ''">
  792. <xsl:attribute name="valign">
  793. <xsl:value-of select="$valign"/>
  794. </xsl:attribute>
  795. </xsl:if>
  796. <xsl:if test="$char != ''">
  797. <xsl:attribute name="char">
  798. <xsl:value-of select="$char"/>
  799. </xsl:attribute>
  800. </xsl:if>
  801. <xsl:if test="$charoff != ''">
  802. <xsl:attribute name="charoff">
  803. <xsl:value-of select="$charoff"/>
  804. </xsl:attribute>
  805. </xsl:if>
  806. <xsl:if test="not(preceding-sibling::*) and (ancestor::row[1]/@id or ancestor::row[1]/@xml:id)">
  807. <xsl:call-template name="anchor">
  808. <xsl:with-param name="node" select="ancestor::row[1]"/>
  809. </xsl:call-template>
  810. </xsl:if>
  811. <xsl:call-template name="anchor"/>
  812. <xsl:choose>
  813. <xsl:when test="$empty.cell">
  814. <xsl:text>&#160;</xsl:text>
  815. </xsl:when>
  816. <xsl:when test="self::entrytbl">
  817. <xsl:call-template name="tgroup"/>
  818. </xsl:when>
  819. <xsl:otherwise>
  820. <xsl:apply-templates/>
  821. </xsl:otherwise>
  822. </xsl:choose>
  823. </xsl:element>
  824. <xsl:choose>
  825. <xsl:when test="following-sibling::entry|following-sibling::entrytbl">
  826. <xsl:apply-templates select="(following-sibling::entry |following-sibling::entrytbl)[1]">
  827. <xsl:with-param name="col" select="$col+$entry.colspan"/>
  828. <xsl:with-param name="spans" select="$following.spans"/>
  829. </xsl:apply-templates>
  830. </xsl:when>
  831. <xsl:otherwise>
  832. <xsl:call-template name="finaltd">
  833. <xsl:with-param name="spans" select="$following.spans"/>
  834. <xsl:with-param name="col" select="$col+$entry.colspan"/>
  835. </xsl:call-template>
  836. </xsl:otherwise>
  837. </xsl:choose>
  838. </xsl:otherwise>
  839. </xsl:choose>
  840. </xsl:template>
  841. <xsl:template match="entry|entrytbl" name="sentry" mode="span">
  842. <xsl:param name="col" select="1"/>
  843. <xsl:param name="spans"/>
  844. <xsl:variable name="entry.colnum">
  845. <xsl:call-template name="entry.colnum"/>
  846. </xsl:variable>
  847. <xsl:variable name="entry.colspan">
  848. <xsl:choose>
  849. <xsl:when test="@spanname or @namest">
  850. <xsl:call-template name="calculate.colspan"/>
  851. </xsl:when>
  852. <xsl:otherwise>1</xsl:otherwise>
  853. </xsl:choose>
  854. </xsl:variable>
  855. <xsl:variable name="following.spans">
  856. <xsl:call-template name="calculate.following.spans">
  857. <xsl:with-param name="colspan" select="$entry.colspan"/>
  858. <xsl:with-param name="spans" select="$spans"/>
  859. </xsl:call-template>
  860. </xsl:variable>
  861. <xsl:choose>
  862. <xsl:when test="$spans != '' and not(starts-with($spans,'0:'))">
  863. <xsl:value-of select="substring-before($spans,':')-1"/>
  864. <xsl:text>:</xsl:text>
  865. <xsl:call-template name="sentry">
  866. <xsl:with-param name="col" select="$col+1"/>
  867. <xsl:with-param name="spans" select="substring-after($spans,':')"/>
  868. </xsl:call-template>
  869. </xsl:when>
  870. <xsl:when test="number($entry.colnum) &gt; $col">
  871. <xsl:text>0:</xsl:text>
  872. <xsl:call-template name="sentry">
  873. <xsl:with-param name="col" select="$col + 1"/>
  874. <xsl:with-param name="spans" select="substring-after($spans,':')"/>
  875. </xsl:call-template>
  876. </xsl:when>
  877. <xsl:otherwise>
  878. <xsl:call-template name="copy-string">
  879. <xsl:with-param name="count" select="$entry.colspan"/>
  880. <xsl:with-param name="string">
  881. <xsl:choose>
  882. <xsl:when test="@morerows">
  883. <xsl:value-of select="@morerows"/>
  884. </xsl:when>
  885. <xsl:otherwise>0</xsl:otherwise>
  886. </xsl:choose>
  887. <xsl:text>:</xsl:text>
  888. </xsl:with-param>
  889. </xsl:call-template>
  890. <xsl:choose>
  891. <xsl:when test="following-sibling::entry|following-sibling::entrytbl">
  892. <xsl:apply-templates select="(following-sibling::entry |following-sibling::entrytbl)[1]" mode="span">
  893. <xsl:with-param name="col" select="$col+$entry.colspan"/>
  894. <xsl:with-param name="spans" select="$following.spans"/>
  895. </xsl:apply-templates>
  896. </xsl:when>
  897. <xsl:otherwise>
  898. <xsl:call-template name="sfinaltd">
  899. <xsl:with-param name="spans" select="$following.spans"/>
  900. </xsl:call-template>
  901. </xsl:otherwise>
  902. </xsl:choose>
  903. </xsl:otherwise>
  904. </xsl:choose>
  905. </xsl:template>
  906. <xsl:template name="generate.colgroup">
  907. <xsl:param name="cols" select="1"/>
  908. <xsl:param name="count" select="1"/>
  909. <xsl:choose>
  910. <xsl:when test="$count &gt; $cols"/>
  911. <xsl:otherwise>
  912. <xsl:call-template name="generate.col">
  913. <xsl:with-param name="countcol" select="$count"/>
  914. </xsl:call-template>
  915. <xsl:call-template name="generate.colgroup">
  916. <xsl:with-param name="cols" select="$cols"/>
  917. <xsl:with-param name="count" select="$count+1"/>
  918. </xsl:call-template>
  919. </xsl:otherwise>
  920. </xsl:choose>
  921. </xsl:template>
  922. <xsl:template name="generate.col">
  923. <xsl:param name="countcol">1</xsl:param>
  924. <xsl:param name="colspecs" select="./colspec"/>
  925. <xsl:param name="count">1</xsl:param>
  926. <xsl:param name="colnum">1</xsl:param>
  927. <xsl:choose>
  928. <xsl:when test="$count&gt;count($colspecs)">
  929. <col/>
  930. </xsl:when>
  931. <xsl:otherwise>
  932. <xsl:variable name="colspec" select="$colspecs[$count=position()]"/>
  933. <xsl:variable name="colspec.colnum">
  934. <xsl:choose>
  935. <xsl:when test="$colspec/@colnum">
  936. <xsl:value-of select="$colspec/@colnum"/>
  937. </xsl:when>
  938. <xsl:otherwise>
  939. <xsl:value-of select="$colnum"/>
  940. </xsl:otherwise>
  941. </xsl:choose>
  942. </xsl:variable>
  943. <xsl:choose>
  944. <xsl:when test="$colspec.colnum=$countcol">
  945. <col>
  946. <xsl:choose>
  947. <xsl:when test="$colspec/@colwidth and $use.extensions != 0 and $tablecolumns.extension != 0">
  948. <xsl:attribute name="width">
  949. <xsl:choose>
  950. <xsl:when test="normalize-space($colspec/@colwidth) = '*'">
  951. <xsl:value-of select="'1*'"/>
  952. </xsl:when>
  953. <xsl:otherwise>
  954. <xsl:value-of select="$colspec/@colwidth"/>
  955. </xsl:otherwise>
  956. </xsl:choose>
  957. </xsl:attribute>
  958. </xsl:when>
  959. <!-- pass through to HTML if no * in colspecs -->
  960. <xsl:when test="$colspec/@colwidth and not($colspec/parent::*/colspec/@colwidth[contains(.,'*')])">
  961. <xsl:attribute name="width">
  962. <xsl:choose>
  963. <xsl:when test="normalize-space($colspec/@colwidth) = '*'">
  964. <xsl:value-of select="'1*'"/>
  965. </xsl:when>
  966. <xsl:otherwise>
  967. <xsl:value-of select="$colspec/@colwidth"/>
  968. </xsl:otherwise>
  969. </xsl:choose>
  970. </xsl:attribute>
  971. </xsl:when>
  972. </xsl:choose>
  973. <xsl:choose>
  974. <xsl:when test="$colspec/@align">
  975. <xsl:attribute name="align">
  976. <xsl:value-of select="$colspec/@align"/>
  977. </xsl:attribute>
  978. </xsl:when>
  979. <!-- Suggested by Pavel ZAMPACH <zampach@nemcb.cz> -->
  980. <xsl:when test="$colspecs/ancestor::tgroup/@align">
  981. <xsl:attribute name="align">
  982. <xsl:value-of select="$colspecs/ancestor::tgroup/@align"/>
  983. </xsl:attribute>
  984. </xsl:when>
  985. </xsl:choose>
  986. <xsl:if test="$colspec/@char">
  987. <xsl:attribute name="char">
  988. <xsl:value-of select="$colspec/@char"/>
  989. </xsl:attribute>
  990. </xsl:if>
  991. <xsl:if test="$colspec/@charoff">
  992. <xsl:attribute name="charoff">
  993. <xsl:value-of select="$colspec/@charoff"/>
  994. </xsl:attribute>
  995. </xsl:if>
  996. <xsl:if test="$colspec/@colname">
  997. <xsl:attribute name="class">
  998. <xsl:value-of select="$colspec/@colname"/>
  999. </xsl:attribute>
  1000. </xsl:if>
  1001. </col>
  1002. </xsl:when>
  1003. <xsl:otherwise>
  1004. <xsl:call-template name="generate.col">
  1005. <xsl:with-param name="countcol" select="$countcol"/>
  1006. <xsl:with-param name="colspecs" select="$colspecs"/>
  1007. <xsl:with-param name="count" select="$count+1"/>
  1008. <xsl:with-param name="colnum">
  1009. <xsl:choose>
  1010. <xsl:when test="$colspec/@colnum">
  1011. <xsl:value-of select="$colspec/@colnum + 1"/>
  1012. </xsl:when>
  1013. <xsl:otherwise>
  1014. <xsl:value-of select="$colnum + 1"/>
  1015. </xsl:otherwise>
  1016. </xsl:choose>
  1017. </xsl:with-param>
  1018. </xsl:call-template>
  1019. </xsl:otherwise>
  1020. </xsl:choose>
  1021. </xsl:otherwise>
  1022. </xsl:choose>
  1023. </xsl:template>
  1024. <xsl:template name="colspec.colwidth">
  1025. <!-- when this macro is called, the current context must be an entry -->
  1026. <xsl:param name="colname"/>
  1027. <!-- .. = row, ../.. = thead|tbody, ../../.. = tgroup -->
  1028. <xsl:param name="colspecs" select="../../../../tgroup/colspec"/>
  1029. <xsl:param name="count">1</xsl:param>
  1030. <xsl:choose>
  1031. <xsl:when test="$count&gt;count($colspecs)"/>
  1032. <xsl:otherwise>
  1033. <xsl:variable name="colspec" select="$colspecs[$count=position()]"/>
  1034. <xsl:choose>
  1035. <xsl:when test="$colspec/@colname=$colname">
  1036. <xsl:value-of select="$colspec/@colwidth"/>
  1037. </xsl:when>
  1038. <xsl:otherwise>
  1039. <xsl:call-template name="colspec.colwidth">
  1040. <xsl:with-param name="colname" select="$colname"/>
  1041. <xsl:with-param name="colspecs" select="$colspecs"/>
  1042. <xsl:with-param name="count" select="$count+1"/>
  1043. </xsl:call-template>
  1044. </xsl:otherwise>
  1045. </xsl:choose>
  1046. </xsl:otherwise>
  1047. </xsl:choose>
  1048. </xsl:template>
  1049. <!-- ====================================================================== -->
  1050. <xsl:template name="tr.attributes">
  1051. <xsl:param name="row" select="."/>
  1052. <xsl:param name="rownum" select="0"/>
  1053. <!-- by default, do nothing. But you might want to say:
  1054. <xsl:if test="$rownum mod 2 = 0">
  1055. <xsl:attribute name="class">oddrow</xsl:attribute>
  1056. </xsl:if>
  1057. -->
  1058. </xsl:template>
  1059. </xsl:stylesheet>