table.xsl 40 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113
  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$
  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="dbhtml-attribute">
  121. <xsl:with-param name="pis" select="processing-instruction('dbhtml')"/>
  122. <xsl:with-param name="attribute" select="'table-summary'"/>
  123. </xsl:call-template>
  124. </xsl:variable>
  125. <xsl:variable name="cellspacing">
  126. <xsl:call-template name="dbhtml-attribute">
  127. <xsl:with-param name="pis" select="processing-instruction('dbhtml')"/>
  128. <xsl:with-param name="attribute" select="'cellspacing'"/>
  129. </xsl:call-template>
  130. </xsl:variable>
  131. <xsl:variable name="cellpadding">
  132. <xsl:call-template name="dbhtml-attribute">
  133. <xsl:with-param name="pis" select="processing-instruction('dbhtml')[1]"/>
  134. <xsl:with-param name="attribute" select="'cellpadding'"/>
  135. </xsl:call-template>
  136. </xsl:variable>
  137. <table>
  138. <xsl:choose>
  139. <!-- If there's a textobject/phrase for the table summary, use it -->
  140. <xsl:when test="../textobject/phrase">
  141. <xsl:attribute name="summary">
  142. <xsl:value-of select="../textobject/phrase"/>
  143. </xsl:attribute>
  144. </xsl:when>
  145. <!-- If there's a <?dbhtml table-summary="foo"?> PI, use it for
  146. the HTML table summary attribute -->
  147. <xsl:when test="$summary != ''">
  148. <xsl:attribute name="summary">
  149. <xsl:value-of select="$summary"/>
  150. </xsl:attribute>
  151. </xsl:when>
  152. <!-- Otherwise, if there's a title, use that -->
  153. <xsl:when test="../title">
  154. <xsl:attribute name="summary">
  155. <xsl:value-of select="string(../title)"/>
  156. </xsl:attribute>
  157. </xsl:when>
  158. <!-- Otherwise, forget the whole idea -->
  159. <xsl:otherwise><!-- nevermind --></xsl:otherwise>
  160. </xsl:choose>
  161. <xsl:if test="$cellspacing != '' or $html.cellspacing != ''">
  162. <xsl:attribute name="cellspacing">
  163. <xsl:choose>
  164. <xsl:when test="$cellspacing != ''">
  165. <xsl:value-of select="$cellspacing"/>
  166. </xsl:when>
  167. <xsl:otherwise>
  168. <xsl:value-of select="$html.cellspacing"/>
  169. </xsl:otherwise>
  170. </xsl:choose>
  171. </xsl:attribute>
  172. </xsl:if>
  173. <xsl:if test="$cellpadding != '' or $html.cellpadding != ''">
  174. <xsl:attribute name="cellpadding">
  175. <xsl:choose>
  176. <xsl:when test="$cellpadding != ''">
  177. <xsl:value-of select="$cellpadding"/>
  178. </xsl:when>
  179. <xsl:otherwise>
  180. <xsl:value-of select="$html.cellpadding"/>
  181. </xsl:otherwise>
  182. </xsl:choose>
  183. </xsl:attribute>
  184. </xsl:if>
  185. <xsl:if test="../@pgwide=1 or local-name(.) = 'entrytbl'">
  186. <xsl:attribute name="width">100%</xsl:attribute>
  187. </xsl:if>
  188. <xsl:choose>
  189. <xsl:when test="$table.borders.with.css != 0">
  190. <xsl:attribute name="border">0</xsl:attribute>
  191. <xsl:choose>
  192. <xsl:when test="../@frame='all' or (not(../@frame) and $default.table.frame='all')">
  193. <xsl:attribute name="style">
  194. <xsl:text>border-collapse: collapse;</xsl:text>
  195. <xsl:call-template name="border">
  196. <xsl:with-param name="side" select="'top'"/>
  197. <xsl:with-param name="style" select="$table.frame.border.style"/>
  198. <xsl:with-param name="color" select="$table.frame.border.color"/>
  199. <xsl:with-param name="thickness" select="$table.frame.border.thickness"/>
  200. </xsl:call-template>
  201. <xsl:call-template name="border">
  202. <xsl:with-param name="side" select="'bottom'"/>
  203. <xsl:with-param name="style" select="$table.frame.border.style"/>
  204. <xsl:with-param name="color" select="$table.frame.border.color"/>
  205. <xsl:with-param name="thickness" select="$table.frame.border.thickness"/>
  206. </xsl:call-template>
  207. <xsl:call-template name="border">
  208. <xsl:with-param name="side" select="'left'"/>
  209. <xsl:with-param name="style" select="$table.frame.border.style"/>
  210. <xsl:with-param name="color" select="$table.frame.border.color"/>
  211. <xsl:with-param name="thickness" select="$table.frame.border.thickness"/>
  212. </xsl:call-template>
  213. <xsl:call-template name="border">
  214. <xsl:with-param name="side" select="'right'"/>
  215. <xsl:with-param name="style" select="$table.frame.border.style"/>
  216. <xsl:with-param name="color" select="$table.frame.border.color"/>
  217. <xsl:with-param name="thickness" select="$table.frame.border.thickness"/>
  218. </xsl:call-template>
  219. </xsl:attribute>
  220. </xsl:when>
  221. <xsl:when test="../@frame='topbot' or (not(../@frame) and $default.table.frame='topbot')">
  222. <xsl:attribute name="style">
  223. <xsl:text>border-collapse: collapse;</xsl:text>
  224. <xsl:call-template name="border">
  225. <xsl:with-param name="side" select="'top'"/>
  226. <xsl:with-param name="style" select="$table.frame.border.style"/>
  227. <xsl:with-param name="color" select="$table.frame.border.color"/>
  228. <xsl:with-param name="thickness" select="$table.frame.border.thickness"/>
  229. </xsl:call-template>
  230. <xsl:call-template name="border">
  231. <xsl:with-param name="side" select="'bottom'"/>
  232. <xsl:with-param name="style" select="$table.frame.border.style"/>
  233. <xsl:with-param name="color" select="$table.frame.border.color"/>
  234. <xsl:with-param name="thickness" select="$table.frame.border.thickness"/>
  235. </xsl:call-template>
  236. </xsl:attribute>
  237. </xsl:when>
  238. <xsl:when test="../@frame='top' or (not(../@frame) and $default.table.frame='top')">
  239. <xsl:attribute name="style">
  240. <xsl:text>border-collapse: collapse;</xsl:text>
  241. <xsl:call-template name="border">
  242. <xsl:with-param name="side" select="'top'"/>
  243. <xsl:with-param name="style" select="$table.frame.border.style"/>
  244. <xsl:with-param name="color" select="$table.frame.border.color"/>
  245. <xsl:with-param name="thickness" select="$table.frame.border.thickness"/>
  246. </xsl:call-template>
  247. </xsl:attribute>
  248. </xsl:when>
  249. <xsl:when test="../@frame='bottom' or (not(../@frame) and $default.table.frame='bottom')">
  250. <xsl:attribute name="style">
  251. <xsl:text>border-collapse: collapse;</xsl:text>
  252. <xsl:call-template name="border">
  253. <xsl:with-param name="side" select="'bottom'"/>
  254. <xsl:with-param name="style" select="$table.frame.border.style"/>
  255. <xsl:with-param name="color" select="$table.frame.border.color"/>
  256. <xsl:with-param name="thickness" select="$table.frame.border.thickness"/>
  257. </xsl:call-template>
  258. </xsl:attribute>
  259. </xsl:when>
  260. <xsl:when test="../@frame='sides' or (not(../@frame) and $default.table.frame='sides')">
  261. <xsl:attribute name="style">
  262. <xsl:text>border-collapse: collapse;</xsl:text>
  263. <xsl:call-template name="border">
  264. <xsl:with-param name="side" select="'left'"/>
  265. <xsl:with-param name="style" select="$table.frame.border.style"/>
  266. <xsl:with-param name="color" select="$table.frame.border.color"/>
  267. <xsl:with-param name="thickness" select="$table.frame.border.thickness"/>
  268. </xsl:call-template>
  269. <xsl:call-template name="border">
  270. <xsl:with-param name="side" select="'right'"/>
  271. <xsl:with-param name="style" select="$table.frame.border.style"/>
  272. <xsl:with-param name="color" select="$table.frame.border.color"/>
  273. <xsl:with-param name="thickness" select="$table.frame.border.thickness"/>
  274. </xsl:call-template>
  275. </xsl:attribute>
  276. </xsl:when>
  277. <xsl:otherwise>
  278. <xsl:attribute name="style">
  279. <xsl:text>border-collapse: collapse;</xsl:text>
  280. </xsl:attribute>
  281. </xsl:otherwise>
  282. </xsl:choose>
  283. </xsl:when>
  284. <xsl:when test="../@frame='none' or (not(../@frame) and $default.table.frame='none') or local-name(.) = 'entrytbl'">
  285. <xsl:attribute name="border">0</xsl:attribute>
  286. </xsl:when>
  287. <xsl:otherwise>
  288. <xsl:attribute name="border">1</xsl:attribute>
  289. </xsl:otherwise>
  290. </xsl:choose>
  291. <xsl:variable name="colgroup">
  292. <colgroup>
  293. <xsl:call-template name="generate.colgroup">
  294. <xsl:with-param name="cols" select="@cols"/>
  295. </xsl:call-template>
  296. </colgroup>
  297. </xsl:variable>
  298. <xsl:variable name="explicit.table.width">
  299. <xsl:call-template name="dbhtml-attribute">
  300. <xsl:with-param name="pis" select="../processing-instruction('dbhtml')[1]"/>
  301. <xsl:with-param name="attribute" select="'table-width'"/>
  302. </xsl:call-template>
  303. </xsl:variable>
  304. <xsl:variable name="table.width">
  305. <xsl:choose>
  306. <xsl:when test="$explicit.table.width != ''">
  307. <xsl:value-of select="$explicit.table.width"/>
  308. </xsl:when>
  309. <xsl:when test="$default.table.width = ''">
  310. <xsl:text>100%</xsl:text>
  311. </xsl:when>
  312. <xsl:otherwise>
  313. <xsl:value-of select="$default.table.width"/>
  314. </xsl:otherwise>
  315. </xsl:choose>
  316. </xsl:variable>
  317. <xsl:if test="$default.table.width != '' or $explicit.table.width != ''">
  318. <xsl:attribute name="width">
  319. <xsl:choose>
  320. <xsl:when test="contains($table.width, '%')">
  321. <xsl:value-of select="$table.width"/>
  322. </xsl:when>
  323. <xsl:when test="$use.extensions != 0 and $tablecolumns.extension != 0">
  324. <xsl:choose>
  325. <xsl:when test="function-available('stbl:convertLength')">
  326. <xsl:value-of select="stbl:convertLength($table.width)"/>
  327. </xsl:when>
  328. <xsl:when test="function-available('xtbl:convertLength')">
  329. <xsl:value-of select="xtbl:convertLength($table.width)"/>
  330. </xsl:when>
  331. <xsl:otherwise>
  332. <xsl:message terminate="yes">
  333. <xsl:text>No convertLength function available.</xsl:text>
  334. </xsl:message>
  335. </xsl:otherwise>
  336. </xsl:choose>
  337. </xsl:when>
  338. <xsl:otherwise>
  339. <xsl:value-of select="$table.width"/>
  340. </xsl:otherwise>
  341. </xsl:choose>
  342. </xsl:attribute>
  343. </xsl:if>
  344. <xsl:choose>
  345. <xsl:when test="$use.extensions != 0 and $tablecolumns.extension != 0">
  346. <xsl:choose>
  347. <xsl:when test="function-available('stbl:adjustColumnWidths')">
  348. <xsl:copy-of select="stbl:adjustColumnWidths($colgroup)"/>
  349. </xsl:when>
  350. <xsl:when test="function-available('xtbl:adjustColumnWidths')">
  351. <xsl:copy-of select="xtbl:adjustColumnWidths($colgroup)"/>
  352. </xsl:when>
  353. <xsl:when test="function-available('ptbl:adjustColumnWidths')">
  354. <xsl:copy-of select="ptbl:adjustColumnWidths($colgroup)"/>
  355. </xsl:when>
  356. <xsl:otherwise>
  357. <xsl:message terminate="yes">
  358. <xsl:text>No adjustColumnWidths function available.</xsl:text>
  359. </xsl:message>
  360. </xsl:otherwise>
  361. </xsl:choose>
  362. </xsl:when>
  363. <xsl:otherwise>
  364. <xsl:copy-of select="$colgroup"/>
  365. </xsl:otherwise>
  366. </xsl:choose>
  367. <xsl:apply-templates select="thead"/>
  368. <xsl:apply-templates select="tfoot"/>
  369. <xsl:apply-templates select="tbody"/>
  370. <xsl:if test=".//footnote">
  371. <tbody class="footnotes">
  372. <tr>
  373. <td colspan="{@cols}">
  374. <xsl:apply-templates select=".//footnote" mode="table.footnote.mode"/>
  375. </td>
  376. </tr>
  377. </tbody>
  378. </xsl:if>
  379. </table>
  380. </xsl:template>
  381. <xsl:template match="tgroup/processing-instruction('dbhtml')">
  382. <xsl:variable name="summary">
  383. <xsl:call-template name="dbhtml-attribute">
  384. <xsl:with-param name="pis" select="."/>
  385. <xsl:with-param name="attribute" select="'table-summary'"/>
  386. </xsl:call-template>
  387. </xsl:variable>
  388. <!-- Suppress the table-summary PI -->
  389. <xsl:if test="$summary = ''">
  390. <xsl:processing-instruction name="dbhtml">
  391. <xsl:value-of select="."/>
  392. </xsl:processing-instruction>
  393. </xsl:if>
  394. </xsl:template>
  395. <xsl:template match="colspec"/>
  396. <xsl:template match="spanspec"/>
  397. <xsl:template match="thead|tfoot">
  398. <xsl:element name="{local-name(.)}" namespace="http://www.w3.org/1999/xhtml">
  399. <xsl:if test="@align">
  400. <xsl:attribute name="align">
  401. <xsl:value-of select="@align"/>
  402. </xsl:attribute>
  403. </xsl:if>
  404. <xsl:if test="@char">
  405. <xsl:attribute name="char">
  406. <xsl:value-of select="@char"/>
  407. </xsl:attribute>
  408. </xsl:if>
  409. <xsl:if test="@charoff">
  410. <xsl:attribute name="charoff">
  411. <xsl:value-of select="@charoff"/>
  412. </xsl:attribute>
  413. </xsl:if>
  414. <xsl:if test="@valign">
  415. <xsl:attribute name="valign">
  416. <xsl:value-of select="@valign"/>
  417. </xsl:attribute>
  418. </xsl:if>
  419. <xsl:apply-templates select="row[1]">
  420. <xsl:with-param name="spans">
  421. <xsl:call-template name="blank.spans">
  422. <xsl:with-param name="cols" select="../@cols"/>
  423. </xsl:call-template>
  424. </xsl:with-param>
  425. </xsl:apply-templates>
  426. </xsl:element>
  427. </xsl:template>
  428. <xsl:template match="tbody">
  429. <tbody>
  430. <xsl:if test="@align">
  431. <xsl:attribute name="align">
  432. <xsl:value-of select="@align"/>
  433. </xsl:attribute>
  434. </xsl:if>
  435. <xsl:if test="@char">
  436. <xsl:attribute name="char">
  437. <xsl:value-of select="@char"/>
  438. </xsl:attribute>
  439. </xsl:if>
  440. <xsl:if test="@charoff">
  441. <xsl:attribute name="charoff">
  442. <xsl:value-of select="@charoff"/>
  443. </xsl:attribute>
  444. </xsl:if>
  445. <xsl:if test="@valign">
  446. <xsl:attribute name="valign">
  447. <xsl:value-of select="@valign"/>
  448. </xsl:attribute>
  449. </xsl:if>
  450. <xsl:apply-templates select="row[1]">
  451. <xsl:with-param name="spans">
  452. <xsl:call-template name="blank.spans">
  453. <xsl:with-param name="cols" select="../@cols"/>
  454. </xsl:call-template>
  455. </xsl:with-param>
  456. </xsl:apply-templates>
  457. </tbody>
  458. </xsl:template>
  459. <xsl:template match="row">
  460. <xsl:param name="spans"/>
  461. <xsl:choose>
  462. <xsl:when test="contains($spans, '0')">
  463. <xsl:call-template name="normal-row">
  464. <xsl:with-param name="spans" select="$spans"/>
  465. </xsl:call-template>
  466. </xsl:when>
  467. <xsl:otherwise>
  468. <!--
  469. <xsl:message>
  470. <xsl:text>Ignoring row: </xsl:text>
  471. <xsl:value-of select="$spans"/>
  472. <xsl:text> = </xsl:text>
  473. <xsl:call-template name="consume-row">
  474. <xsl:with-param name="spans" select="$spans"/>
  475. </xsl:call-template>
  476. </xsl:message>
  477. -->
  478. <xsl:if test="normalize-space(.//text()) != ''">
  479. <xsl:message>Warning: overlapped row contains content!</xsl:message>
  480. </xsl:if>
  481. <tr><xsl:comment> This row intentionally left blank </xsl:comment></tr>
  482. <xsl:apply-templates select="following-sibling::row[1]">
  483. <xsl:with-param name="spans">
  484. <xsl:call-template name="consume-row">
  485. <xsl:with-param name="spans" select="$spans"/>
  486. </xsl:call-template>
  487. </xsl:with-param>
  488. </xsl:apply-templates>
  489. </xsl:otherwise>
  490. </xsl:choose>
  491. </xsl:template>
  492. <xsl:template name="normal-row">
  493. <xsl:param name="spans"/>
  494. <xsl:variable name="row-height">
  495. <xsl:if test="processing-instruction('dbhtml')">
  496. <xsl:call-template name="dbhtml-attribute">
  497. <xsl:with-param name="pis" select="processing-instruction('dbhtml')"/>
  498. <xsl:with-param name="attribute" select="'row-height'"/>
  499. </xsl:call-template>
  500. </xsl:if>
  501. </xsl:variable>
  502. <xsl:variable name="bgcolor">
  503. <xsl:if test="processing-instruction('dbhtml')">
  504. <xsl:call-template name="dbhtml-attribute">
  505. <xsl:with-param name="pis" select="processing-instruction('dbhtml')"/>
  506. <xsl:with-param name="attribute" select="'bgcolor'"/>
  507. </xsl:call-template>
  508. </xsl:if>
  509. </xsl:variable>
  510. <xsl:variable name="class">
  511. <xsl:if test="processing-instruction('dbhtml')">
  512. <xsl:call-template name="dbhtml-attribute">
  513. <xsl:with-param name="pis" select="processing-instruction('dbhtml')"/>
  514. <xsl:with-param name="attribute" select="'class'"/>
  515. </xsl:call-template>
  516. </xsl:if>
  517. </xsl:variable>
  518. <tr>
  519. <xsl:call-template name="tr.attributes">
  520. <xsl:with-param name="rownum">
  521. <xsl:number from="tgroup" count="row"/>
  522. </xsl:with-param>
  523. </xsl:call-template>
  524. <xsl:if test="$row-height != ''">
  525. <xsl:attribute name="height">
  526. <xsl:value-of select="$row-height"/>
  527. </xsl:attribute>
  528. </xsl:if>
  529. <xsl:if test="$bgcolor != ''">
  530. <xsl:attribute name="bgcolor">
  531. <xsl:value-of select="$bgcolor"/>
  532. </xsl:attribute>
  533. </xsl:if>
  534. <xsl:if test="$class != ''">
  535. <xsl:attribute name="class">
  536. <xsl:value-of select="$class"/>
  537. </xsl:attribute>
  538. </xsl:if>
  539. <xsl:if test="$table.borders.with.css != 0">
  540. <xsl:if test="@rowsep = 1 and following-sibling::row">
  541. <xsl:attribute name="style">
  542. <xsl:call-template name="border">
  543. <xsl:with-param name="side" select="'bottom'"/>
  544. </xsl:call-template>
  545. </xsl:attribute>
  546. </xsl:if>
  547. </xsl:if>
  548. <xsl:if test="@align">
  549. <xsl:attribute name="align">
  550. <xsl:value-of select="@align"/>
  551. </xsl:attribute>
  552. </xsl:if>
  553. <xsl:if test="@char">
  554. <xsl:attribute name="char">
  555. <xsl:value-of select="@char"/>
  556. </xsl:attribute>
  557. </xsl:if>
  558. <xsl:if test="@charoff">
  559. <xsl:attribute name="charoff">
  560. <xsl:value-of select="@charoff"/>
  561. </xsl:attribute>
  562. </xsl:if>
  563. <xsl:if test="@valign">
  564. <xsl:attribute name="valign">
  565. <xsl:value-of select="@valign"/>
  566. </xsl:attribute>
  567. </xsl:if>
  568. <xsl:apply-templates select="(entry|entrytbl)[1]">
  569. <xsl:with-param name="spans" select="$spans"/>
  570. </xsl:apply-templates>
  571. </tr>
  572. <xsl:if test="following-sibling::row">
  573. <xsl:variable name="nextspans">
  574. <xsl:apply-templates select="(entry|entrytbl)[1]" mode="span">
  575. <xsl:with-param name="spans" select="$spans"/>
  576. </xsl:apply-templates>
  577. </xsl:variable>
  578. <xsl:apply-templates select="following-sibling::row[1]">
  579. <xsl:with-param name="spans" select="$nextspans"/>
  580. </xsl:apply-templates>
  581. </xsl:if>
  582. </xsl:template>
  583. <xsl:template match="entry|entrytbl" name="entry">
  584. <xsl:param name="col" select="1"/>
  585. <xsl:param name="spans"/>
  586. <xsl:variable name="cellgi">
  587. <xsl:choose>
  588. <xsl:when test="ancestor::thead">th</xsl:when>
  589. <xsl:when test="ancestor::tfoot">th</xsl:when>
  590. <xsl:otherwise>td</xsl:otherwise>
  591. </xsl:choose>
  592. </xsl:variable>
  593. <xsl:variable name="empty.cell" select="count(node()) = 0"/>
  594. <xsl:variable name="named.colnum">
  595. <xsl:call-template name="entry.colnum"/>
  596. </xsl:variable>
  597. <xsl:variable name="entry.colnum">
  598. <xsl:choose>
  599. <xsl:when test="$named.colnum &gt; 0">
  600. <xsl:value-of select="$named.colnum"/>
  601. </xsl:when>
  602. <xsl:otherwise>
  603. <xsl:value-of select="$col"/>
  604. </xsl:otherwise>
  605. </xsl:choose>
  606. </xsl:variable>
  607. <xsl:variable name="entry.colspan">
  608. <xsl:choose>
  609. <xsl:when test="@spanname or @namest">
  610. <xsl:call-template name="calculate.colspan"/>
  611. </xsl:when>
  612. <xsl:otherwise>1</xsl:otherwise>
  613. </xsl:choose>
  614. </xsl:variable>
  615. <xsl:variable name="following.spans">
  616. <xsl:call-template name="calculate.following.spans">
  617. <xsl:with-param name="colspan" select="$entry.colspan"/>
  618. <xsl:with-param name="spans" select="$spans"/>
  619. </xsl:call-template>
  620. </xsl:variable>
  621. <xsl:variable name="rowsep">
  622. <xsl:choose>
  623. <!-- If this is the last row, rowsep never applies. -->
  624. <xsl:when test="ancestor::entrytbl and not (ancestor-or-self::row[1]/following-sibling::row)">
  625. <xsl:value-of select="0"/>
  626. </xsl:when>
  627. <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)">
  628. <xsl:value-of select="0"/>
  629. </xsl:when>
  630. <xsl:when test="@morerows and not(@morerows &lt; count(ancestor-or-self::row[1]/following-sibling::row))">
  631. <xsl:value-of select="0"/>
  632. </xsl:when>
  633. <xsl:otherwise>
  634. <xsl:call-template name="inherited.table.attribute">
  635. <xsl:with-param name="entry" select="."/>
  636. <xsl:with-param name="colnum" select="$entry.colnum"/>
  637. <xsl:with-param name="attribute" select="'rowsep'"/>
  638. </xsl:call-template>
  639. </xsl:otherwise>
  640. </xsl:choose>
  641. </xsl:variable>
  642. <xsl:variable name="colsep">
  643. <xsl:choose>
  644. <!-- If this is the last column, colsep never applies. -->
  645. <xsl:when test="$following.spans = ''">0</xsl:when>
  646. <xsl:otherwise>
  647. <xsl:call-template name="inherited.table.attribute">
  648. <xsl:with-param name="entry" select="."/>
  649. <xsl:with-param name="colnum" select="$entry.colnum"/>
  650. <xsl:with-param name="attribute" select="'colsep'"/>
  651. </xsl:call-template>
  652. </xsl:otherwise>
  653. </xsl:choose>
  654. </xsl:variable>
  655. <xsl:variable name="valign">
  656. <xsl:call-template name="inherited.table.attribute">
  657. <xsl:with-param name="entry" select="."/>
  658. <xsl:with-param name="colnum" select="$entry.colnum"/>
  659. <xsl:with-param name="attribute" select="'valign'"/>
  660. </xsl:call-template>
  661. </xsl:variable>
  662. <xsl:variable name="align">
  663. <xsl:call-template name="inherited.table.attribute">
  664. <xsl:with-param name="entry" select="."/>
  665. <xsl:with-param name="colnum" select="$entry.colnum"/>
  666. <xsl:with-param name="attribute" select="'align'"/>
  667. </xsl:call-template>
  668. </xsl:variable>
  669. <xsl:variable name="char">
  670. <xsl:call-template name="inherited.table.attribute">
  671. <xsl:with-param name="entry" select="."/>
  672. <xsl:with-param name="colnum" select="$entry.colnum"/>
  673. <xsl:with-param name="attribute" select="'char'"/>
  674. </xsl:call-template>
  675. </xsl:variable>
  676. <xsl:variable name="charoff">
  677. <xsl:call-template name="inherited.table.attribute">
  678. <xsl:with-param name="entry" select="."/>
  679. <xsl:with-param name="colnum" select="$entry.colnum"/>
  680. <xsl:with-param name="attribute" select="'charoff'"/>
  681. </xsl:call-template>
  682. </xsl:variable>
  683. <xsl:choose>
  684. <xsl:when test="$spans != '' and not(starts-with($spans,'0:'))">
  685. <xsl:call-template name="entry">
  686. <xsl:with-param name="col" select="$col+1"/>
  687. <xsl:with-param name="spans" select="substring-after($spans,':')"/>
  688. </xsl:call-template>
  689. </xsl:when>
  690. <xsl:when test="number($entry.colnum) &gt; $col">
  691. <xsl:call-template name="empty.table.cell"/>
  692. <xsl:call-template name="entry">
  693. <xsl:with-param name="col" select="$col+1"/>
  694. <xsl:with-param name="spans" select="substring-after($spans,':')"/>
  695. </xsl:call-template>
  696. </xsl:when>
  697. <xsl:otherwise>
  698. <xsl:variable name="bgcolor">
  699. <xsl:if test="processing-instruction('dbhtml')">
  700. <xsl:call-template name="dbhtml-attribute">
  701. <xsl:with-param name="pis" select="processing-instruction('dbhtml')"/>
  702. <xsl:with-param name="attribute" select="'bgcolor'"/>
  703. </xsl:call-template>
  704. </xsl:if>
  705. </xsl:variable>
  706. <xsl:element name="{$cellgi}" namespace="http://www.w3.org/1999/xhtml">
  707. <xsl:if test="$bgcolor != ''">
  708. <xsl:attribute name="bgcolor">
  709. <xsl:value-of select="$bgcolor"/>
  710. </xsl:attribute>
  711. </xsl:if>
  712. <xsl:if test="$entry.propagates.style != 0 and @role">
  713. <xsl:apply-templates select="." mode="class.attribute">
  714. <xsl:with-param name="class" select="@role"/>
  715. </xsl:apply-templates>
  716. </xsl:if>
  717. <xsl:if test="$show.revisionflag and @revisionflag">
  718. <xsl:attribute name="class">
  719. <xsl:value-of select="@revisionflag"/>
  720. </xsl:attribute>
  721. </xsl:if>
  722. <xsl:if test="$table.borders.with.css != 0">
  723. <xsl:attribute name="style">
  724. <xsl:if test="$colsep &gt; 0">
  725. <xsl:call-template name="border">
  726. <xsl:with-param name="side" select="'right'"/>
  727. </xsl:call-template>
  728. </xsl:if>
  729. <xsl:if test="$rowsep &gt; 0">
  730. <xsl:call-template name="border">
  731. <xsl:with-param name="side" select="'bottom'"/>
  732. </xsl:call-template>
  733. </xsl:if>
  734. </xsl:attribute>
  735. </xsl:if>
  736. <xsl:if test="@morerows &gt; 0">
  737. <xsl:attribute name="rowspan">
  738. <xsl:value-of select="1+@morerows"/>
  739. </xsl:attribute>
  740. </xsl:if>
  741. <xsl:if test="$entry.colspan &gt; 1">
  742. <xsl:attribute name="colspan">
  743. <xsl:value-of select="$entry.colspan"/>
  744. </xsl:attribute>
  745. </xsl:if>
  746. <xsl:if test="$align != ''">
  747. <xsl:attribute name="align">
  748. <xsl:value-of select="$align"/>
  749. </xsl:attribute>
  750. </xsl:if>
  751. <xsl:if test="$valign != ''">
  752. <xsl:attribute name="valign">
  753. <xsl:value-of select="$valign"/>
  754. </xsl:attribute>
  755. </xsl:if>
  756. <xsl:if test="$char != ''">
  757. <xsl:attribute name="char">
  758. <xsl:value-of select="$char"/>
  759. </xsl:attribute>
  760. </xsl:if>
  761. <xsl:if test="$charoff != ''">
  762. <xsl:attribute name="charoff">
  763. <xsl:value-of select="$charoff"/>
  764. </xsl:attribute>
  765. </xsl:if>
  766. <xsl:if test="not(preceding-sibling::*) and (ancestor::row[1]/@id or ancestor::row[1]/@xml:id)">
  767. <xsl:call-template name="anchor">
  768. <xsl:with-param name="node" select="ancestor::row[1]"/>
  769. </xsl:call-template>
  770. </xsl:if>
  771. <xsl:call-template name="anchor"/>
  772. <xsl:choose>
  773. <xsl:when test="$empty.cell">
  774. <xsl:text>&#160;</xsl:text>
  775. </xsl:when>
  776. <xsl:when test="self::entrytbl">
  777. <xsl:call-template name="tgroup"/>
  778. </xsl:when>
  779. <xsl:otherwise>
  780. <xsl:apply-templates/>
  781. </xsl:otherwise>
  782. </xsl:choose>
  783. </xsl:element>
  784. <xsl:choose>
  785. <xsl:when test="following-sibling::entry|following-sibling::entrytbl">
  786. <xsl:apply-templates select="(following-sibling::entry |following-sibling::entrytbl)[1]">
  787. <xsl:with-param name="col" select="$col+$entry.colspan"/>
  788. <xsl:with-param name="spans" select="$following.spans"/>
  789. </xsl:apply-templates>
  790. </xsl:when>
  791. <xsl:otherwise>
  792. <xsl:call-template name="finaltd">
  793. <xsl:with-param name="spans" select="$following.spans"/>
  794. <xsl:with-param name="col" select="$col+$entry.colspan"/>
  795. </xsl:call-template>
  796. </xsl:otherwise>
  797. </xsl:choose>
  798. </xsl:otherwise>
  799. </xsl:choose>
  800. </xsl:template>
  801. <xsl:template match="entry|entrytbl" name="sentry" mode="span">
  802. <xsl:param name="col" select="1"/>
  803. <xsl:param name="spans"/>
  804. <xsl:variable name="entry.colnum">
  805. <xsl:call-template name="entry.colnum"/>
  806. </xsl:variable>
  807. <xsl:variable name="entry.colspan">
  808. <xsl:choose>
  809. <xsl:when test="@spanname or @namest">
  810. <xsl:call-template name="calculate.colspan"/>
  811. </xsl:when>
  812. <xsl:otherwise>1</xsl:otherwise>
  813. </xsl:choose>
  814. </xsl:variable>
  815. <xsl:variable name="following.spans">
  816. <xsl:call-template name="calculate.following.spans">
  817. <xsl:with-param name="colspan" select="$entry.colspan"/>
  818. <xsl:with-param name="spans" select="$spans"/>
  819. </xsl:call-template>
  820. </xsl:variable>
  821. <xsl:choose>
  822. <xsl:when test="$spans != '' and not(starts-with($spans,'0:'))">
  823. <xsl:value-of select="substring-before($spans,':')-1"/>
  824. <xsl:text>:</xsl:text>
  825. <xsl:call-template name="sentry">
  826. <xsl:with-param name="col" select="$col+1"/>
  827. <xsl:with-param name="spans" select="substring-after($spans,':')"/>
  828. </xsl:call-template>
  829. </xsl:when>
  830. <xsl:when test="number($entry.colnum) &gt; $col">
  831. <xsl:text>0:</xsl:text>
  832. <xsl:call-template name="sentry">
  833. <xsl:with-param name="col" select="$col+$entry.colspan"/>
  834. <xsl:with-param name="spans" select="$following.spans"/>
  835. </xsl:call-template>
  836. </xsl:when>
  837. <xsl:otherwise>
  838. <xsl:call-template name="copy-string">
  839. <xsl:with-param name="count" select="$entry.colspan"/>
  840. <xsl:with-param name="string">
  841. <xsl:choose>
  842. <xsl:when test="@morerows">
  843. <xsl:value-of select="@morerows"/>
  844. </xsl:when>
  845. <xsl:otherwise>0</xsl:otherwise>
  846. </xsl:choose>
  847. <xsl:text>:</xsl:text>
  848. </xsl:with-param>
  849. </xsl:call-template>
  850. <xsl:choose>
  851. <xsl:when test="following-sibling::entry|following-sibling::entrytbl">
  852. <xsl:apply-templates select="(following-sibling::entry |following-sibling::entrytbl)[1]" mode="span">
  853. <xsl:with-param name="col" select="$col+$entry.colspan"/>
  854. <xsl:with-param name="spans" select="$following.spans"/>
  855. </xsl:apply-templates>
  856. </xsl:when>
  857. <xsl:otherwise>
  858. <xsl:call-template name="sfinaltd">
  859. <xsl:with-param name="spans" select="$following.spans"/>
  860. </xsl:call-template>
  861. </xsl:otherwise>
  862. </xsl:choose>
  863. </xsl:otherwise>
  864. </xsl:choose>
  865. </xsl:template>
  866. <xsl:template name="generate.colgroup">
  867. <xsl:param name="cols" select="1"/>
  868. <xsl:param name="count" select="1"/>
  869. <xsl:choose>
  870. <xsl:when test="$count &gt; $cols"/>
  871. <xsl:otherwise>
  872. <xsl:call-template name="generate.col">
  873. <xsl:with-param name="countcol" select="$count"/>
  874. </xsl:call-template>
  875. <xsl:call-template name="generate.colgroup">
  876. <xsl:with-param name="cols" select="$cols"/>
  877. <xsl:with-param name="count" select="$count+1"/>
  878. </xsl:call-template>
  879. </xsl:otherwise>
  880. </xsl:choose>
  881. </xsl:template>
  882. <xsl:template name="generate.col">
  883. <xsl:param name="countcol">1</xsl:param>
  884. <xsl:param name="colspecs" select="./colspec"/>
  885. <xsl:param name="count">1</xsl:param>
  886. <xsl:param name="colnum">1</xsl:param>
  887. <xsl:choose>
  888. <xsl:when test="$count&gt;count($colspecs)">
  889. <col/>
  890. </xsl:when>
  891. <xsl:otherwise>
  892. <xsl:variable name="colspec" select="$colspecs[$count=position()]"/>
  893. <xsl:variable name="colspec.colnum">
  894. <xsl:choose>
  895. <xsl:when test="$colspec/@colnum">
  896. <xsl:value-of select="$colspec/@colnum"/>
  897. </xsl:when>
  898. <xsl:otherwise>
  899. <xsl:value-of select="$colnum"/>
  900. </xsl:otherwise>
  901. </xsl:choose>
  902. </xsl:variable>
  903. <xsl:choose>
  904. <xsl:when test="$colspec.colnum=$countcol">
  905. <col>
  906. <xsl:if test="$colspec/@colwidth and $use.extensions != 0 and $tablecolumns.extension != 0">
  907. <xsl:attribute name="width">
  908. <xsl:choose>
  909. <xsl:when test="normalize-space($colspec/@colwidth) = '*'">
  910. <xsl:value-of select="'1*'"/>
  911. </xsl:when>
  912. <xsl:otherwise>
  913. <xsl:value-of select="$colspec/@colwidth"/>
  914. </xsl:otherwise>
  915. </xsl:choose>
  916. </xsl:attribute>
  917. </xsl:if>
  918. <xsl:choose>
  919. <xsl:when test="$colspec/@align">
  920. <xsl:attribute name="align">
  921. <xsl:value-of select="$colspec/@align"/>
  922. </xsl:attribute>
  923. </xsl:when>
  924. <!-- Suggested by Pavel ZAMPACH <zampach@nemcb.cz> -->
  925. <xsl:when test="$colspecs/ancestor::tgroup/@align">
  926. <xsl:attribute name="align">
  927. <xsl:value-of select="$colspecs/ancestor::tgroup/@align"/>
  928. </xsl:attribute>
  929. </xsl:when>
  930. </xsl:choose>
  931. <xsl:if test="$colspec/@char">
  932. <xsl:attribute name="char">
  933. <xsl:value-of select="$colspec/@char"/>
  934. </xsl:attribute>
  935. </xsl:if>
  936. <xsl:if test="$colspec/@charoff">
  937. <xsl:attribute name="charoff">
  938. <xsl:value-of select="$colspec/@charoff"/>
  939. </xsl:attribute>
  940. </xsl:if>
  941. </col>
  942. </xsl:when>
  943. <xsl:otherwise>
  944. <xsl:call-template name="generate.col">
  945. <xsl:with-param name="countcol" select="$countcol"/>
  946. <xsl:with-param name="colspecs" select="$colspecs"/>
  947. <xsl:with-param name="count" select="$count+1"/>
  948. <xsl:with-param name="colnum">
  949. <xsl:choose>
  950. <xsl:when test="$colspec/@colnum">
  951. <xsl:value-of select="$colspec/@colnum + 1"/>
  952. </xsl:when>
  953. <xsl:otherwise>
  954. <xsl:value-of select="$colnum + 1"/>
  955. </xsl:otherwise>
  956. </xsl:choose>
  957. </xsl:with-param>
  958. </xsl:call-template>
  959. </xsl:otherwise>
  960. </xsl:choose>
  961. </xsl:otherwise>
  962. </xsl:choose>
  963. </xsl:template>
  964. <xsl:template name="colspec.colwidth">
  965. <!-- when this macro is called, the current context must be an entry -->
  966. <xsl:param name="colname"/>
  967. <!-- .. = row, ../.. = thead|tbody, ../../.. = tgroup -->
  968. <xsl:param name="colspecs" select="../../../../tgroup/colspec"/>
  969. <xsl:param name="count">1</xsl:param>
  970. <xsl:choose>
  971. <xsl:when test="$count&gt;count($colspecs)"/>
  972. <xsl:otherwise>
  973. <xsl:variable name="colspec" select="$colspecs[$count=position()]"/>
  974. <xsl:choose>
  975. <xsl:when test="$colspec/@colname=$colname">
  976. <xsl:value-of select="$colspec/@colwidth"/>
  977. </xsl:when>
  978. <xsl:otherwise>
  979. <xsl:call-template name="colspec.colwidth">
  980. <xsl:with-param name="colname" select="$colname"/>
  981. <xsl:with-param name="colspecs" select="$colspecs"/>
  982. <xsl:with-param name="count" select="$count+1"/>
  983. </xsl:call-template>
  984. </xsl:otherwise>
  985. </xsl:choose>
  986. </xsl:otherwise>
  987. </xsl:choose>
  988. </xsl:template>
  989. <!-- ====================================================================== -->
  990. <xsl:template name="tr.attributes">
  991. <xsl:param name="row" select="."/>
  992. <xsl:param name="rownum" select="0"/>
  993. <!-- by default, do nothing. But you might want to say:
  994. <xsl:if test="$rownum mod 2 = 0">
  995. <xsl:attribute name="class">oddrow</xsl:attribute>
  996. </xsl:if>
  997. -->
  998. </xsl:template>
  999. </xsl:stylesheet>