lists.xsl 34 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045
  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="http://www.w3.org/1999/xhtml" version="1.0">
  5. <!-- ********************************************************************
  6. $Id$
  7. ********************************************************************
  8. This file is part of the XSL DocBook Stylesheet distribution.
  9. See ../README or http://docbook.sf.net/release/xsl/current/ for
  10. copyright and other information.
  11. ******************************************************************** -->
  12. <!-- ==================================================================== -->
  13. <xsl:template match="itemizedlist">
  14. <div>
  15. <xsl:apply-templates select="." mode="class.attribute"/>
  16. <xsl:call-template name="anchor"/>
  17. <xsl:if test="title">
  18. <xsl:call-template name="formal.object.heading"/>
  19. </xsl:if>
  20. <!-- Preserve order of PIs and comments -->
  21. <xsl:apply-templates select="*[not(self::listitem or self::title or self::titleabbrev)] |comment()[not(preceding-sibling::listitem)] |processing-instruction()[not(preceding-sibling::listitem)]"/>
  22. <ul>
  23. <xsl:if test="$css.decoration != 0">
  24. <xsl:attribute name="type">
  25. <xsl:call-template name="list.itemsymbol"/>
  26. </xsl:attribute>
  27. </xsl:if>
  28. <xsl:if test="@spacing='compact'">
  29. <xsl:attribute name="compact">
  30. <xsl:value-of select="@spacing"/>
  31. </xsl:attribute>
  32. </xsl:if>
  33. <xsl:apply-templates select="listitem |comment()[preceding-sibling::listitem] |processing-instruction()[preceding-sibling::listitem]"/>
  34. </ul>
  35. </div>
  36. </xsl:template>
  37. <xsl:template match="itemizedlist/title">
  38. <!-- nop -->
  39. </xsl:template>
  40. <xsl:template match="itemizedlist/listitem">
  41. <xsl:variable name="mark" select="../@mark"/>
  42. <xsl:variable name="override" select="@override"/>
  43. <xsl:variable name="usemark">
  44. <xsl:choose>
  45. <xsl:when test="$override != ''">
  46. <xsl:value-of select="$override"/>
  47. </xsl:when>
  48. <xsl:otherwise>
  49. <xsl:value-of select="$mark"/>
  50. </xsl:otherwise>
  51. </xsl:choose>
  52. </xsl:variable>
  53. <xsl:variable name="cssmark">
  54. <xsl:choose>
  55. <xsl:when test="$usemark = 'opencircle'">circle</xsl:when>
  56. <xsl:when test="$usemark = 'bullet'">disc</xsl:when>
  57. <xsl:when test="$usemark = 'box'">square</xsl:when>
  58. <xsl:otherwise>
  59. <xsl:value-of select="$usemark"/>
  60. </xsl:otherwise>
  61. </xsl:choose>
  62. </xsl:variable>
  63. <li>
  64. <xsl:if test="$css.decoration = '1' and $cssmark != ''">
  65. <xsl:attribute name="style">
  66. <xsl:text>list-style-type: </xsl:text>
  67. <xsl:value-of select="$cssmark"/>
  68. </xsl:attribute>
  69. </xsl:if>
  70. <!-- we can't just drop the anchor in since some browsers (Opera)
  71. get confused about line breaks if we do. So if the first child
  72. is a para, assume the para will put in the anchor. Otherwise,
  73. put the anchor in anyway. -->
  74. <xsl:if test="local-name(child::*[1]) != 'para'">
  75. <xsl:call-template name="anchor"/>
  76. </xsl:if>
  77. <xsl:choose>
  78. <xsl:when test="$show.revisionflag != 0 and @revisionflag">
  79. <div class="{@revisionflag}">
  80. <xsl:apply-templates/>
  81. </div>
  82. </xsl:when>
  83. <xsl:otherwise>
  84. <xsl:apply-templates/>
  85. </xsl:otherwise>
  86. </xsl:choose>
  87. </li>
  88. </xsl:template>
  89. <xsl:template match="orderedlist">
  90. <xsl:variable name="start">
  91. <xsl:call-template name="orderedlist-starting-number"/>
  92. </xsl:variable>
  93. <xsl:variable name="numeration">
  94. <xsl:call-template name="list.numeration"/>
  95. </xsl:variable>
  96. <xsl:variable name="type">
  97. <xsl:choose>
  98. <xsl:when test="$numeration='arabic'">1</xsl:when>
  99. <xsl:when test="$numeration='loweralpha'">a</xsl:when>
  100. <xsl:when test="$numeration='lowerroman'">i</xsl:when>
  101. <xsl:when test="$numeration='upperalpha'">A</xsl:when>
  102. <xsl:when test="$numeration='upperroman'">I</xsl:when>
  103. <!-- What!? This should never happen -->
  104. <xsl:otherwise>
  105. <xsl:message>
  106. <xsl:text>Unexpected numeration: </xsl:text>
  107. <xsl:value-of select="$numeration"/>
  108. </xsl:message>
  109. <xsl:value-of select="1"/>
  110. </xsl:otherwise>
  111. </xsl:choose>
  112. </xsl:variable>
  113. <div>
  114. <xsl:apply-templates select="." mode="class.attribute"/>
  115. <xsl:call-template name="anchor"/>
  116. <xsl:if test="title">
  117. <xsl:call-template name="formal.object.heading"/>
  118. </xsl:if>
  119. <!-- Preserve order of PIs and comments -->
  120. <xsl:apply-templates select="*[not(self::listitem or self::title or self::titleabbrev)] |comment()[not(preceding-sibling::listitem)] |processing-instruction()[not(preceding-sibling::listitem)]"/>
  121. <ol>
  122. <xsl:if test="$start != '1'">
  123. <xsl:attribute name="start">
  124. <xsl:value-of select="$start"/>
  125. </xsl:attribute>
  126. </xsl:if>
  127. <xsl:if test="$numeration != ''">
  128. <xsl:attribute name="type">
  129. <xsl:value-of select="$type"/>
  130. </xsl:attribute>
  131. </xsl:if>
  132. <xsl:if test="@spacing='compact'">
  133. <xsl:attribute name="compact">
  134. <xsl:value-of select="@spacing"/>
  135. </xsl:attribute>
  136. </xsl:if>
  137. <xsl:apply-templates select="listitem |comment()[preceding-sibling::listitem] |processing-instruction()[preceding-sibling::listitem]"/>
  138. </ol>
  139. </div>
  140. </xsl:template>
  141. <xsl:template match="orderedlist/title">
  142. <!-- nop -->
  143. </xsl:template>
  144. <xsl:template match="orderedlist/listitem">
  145. <li>
  146. <xsl:if test="@override">
  147. <xsl:attribute name="value">
  148. <xsl:value-of select="@override"/>
  149. </xsl:attribute>
  150. </xsl:if>
  151. <!-- we can't just drop the anchor in since some browsers (Opera)
  152. get confused about line breaks if we do. So if the first child
  153. is a para, assume the para will put in the anchor. Otherwise,
  154. put the anchor in anyway. -->
  155. <xsl:if test="local-name(child::*[1]) != 'para'">
  156. <xsl:call-template name="anchor"/>
  157. </xsl:if>
  158. <xsl:choose>
  159. <xsl:when test="$show.revisionflag != 0 and @revisionflag">
  160. <div class="{@revisionflag}">
  161. <xsl:apply-templates/>
  162. </div>
  163. </xsl:when>
  164. <xsl:otherwise>
  165. <xsl:apply-templates/>
  166. </xsl:otherwise>
  167. </xsl:choose>
  168. </li>
  169. </xsl:template>
  170. <xsl:template match="variablelist">
  171. <xsl:variable name="pi-presentation">
  172. <xsl:call-template name="pi.dbhtml_list-presentation"/>
  173. </xsl:variable>
  174. <xsl:variable name="presentation">
  175. <xsl:choose>
  176. <xsl:when test="$pi-presentation != ''">
  177. <xsl:value-of select="$pi-presentation"/>
  178. </xsl:when>
  179. <xsl:when test="$variablelist.as.table != 0">
  180. <xsl:value-of select="'table'"/>
  181. </xsl:when>
  182. <xsl:otherwise>
  183. <xsl:value-of select="'list'"/>
  184. </xsl:otherwise>
  185. </xsl:choose>
  186. </xsl:variable>
  187. <xsl:variable name="list-width">
  188. <xsl:call-template name="pi.dbhtml_list-width"/>
  189. </xsl:variable>
  190. <xsl:variable name="term-width">
  191. <xsl:call-template name="pi.dbhtml_term-width"/>
  192. </xsl:variable>
  193. <xsl:variable name="table-summary">
  194. <xsl:call-template name="pi.dbhtml_table-summary"/>
  195. </xsl:variable>
  196. <div>
  197. <xsl:apply-templates select="." mode="class.attribute"/>
  198. <xsl:call-template name="anchor"/>
  199. <xsl:if test="title">
  200. <xsl:call-template name="formal.object.heading"/>
  201. </xsl:if>
  202. <xsl:choose>
  203. <xsl:when test="$presentation = 'table'">
  204. <!-- Preserve order of PIs and comments -->
  205. <xsl:apply-templates select="*[not(self::varlistentry or self::title or self::titleabbrev)] |comment()[not(preceding-sibling::varlistentry)] |processing-instruction()[not(preceding-sibling::varlistentry)]"/>
  206. <table border="0">
  207. <xsl:if test="$list-width != ''">
  208. <xsl:attribute name="width">
  209. <xsl:value-of select="$list-width"/>
  210. </xsl:attribute>
  211. </xsl:if>
  212. <xsl:if test="$table-summary != ''">
  213. <xsl:attribute name="summary">
  214. <xsl:value-of select="$table-summary"/>
  215. </xsl:attribute>
  216. </xsl:if>
  217. <col align="left" valign="top">
  218. <xsl:if test="$term-width != ''">
  219. <xsl:attribute name="width">
  220. <xsl:value-of select="$term-width"/>
  221. </xsl:attribute>
  222. </xsl:if>
  223. </col>
  224. <tbody>
  225. <xsl:apply-templates mode="varlist-table" select="varlistentry |comment()[preceding-sibling::varlistentry] |processing-instruction()[preceding-sibling::varlistentry]"/>
  226. </tbody>
  227. </table>
  228. </xsl:when>
  229. <xsl:otherwise>
  230. <!-- Preserve order of PIs and comments -->
  231. <xsl:apply-templates select="*[not(self::varlistentry or self::title or self::titleabbrev)] |comment()[not(preceding-sibling::varlistentry)] |processing-instruction()[not(preceding-sibling::varlistentry)]"/>
  232. <dl>
  233. <xsl:apply-templates select="varlistentry |comment()[preceding-sibling::varlistentry] |processing-instruction()[preceding-sibling::varlistentry]"/>
  234. </dl>
  235. </xsl:otherwise>
  236. </xsl:choose>
  237. </div>
  238. </xsl:template>
  239. <xsl:template match="variablelist/title">
  240. <!-- nop -->
  241. </xsl:template>
  242. <xsl:template match="itemizedlist/titleabbrev|orderedlist/titleabbrev">
  243. <!--nop-->
  244. </xsl:template>
  245. <xsl:template match="variablelist/titleabbrev">
  246. <!--nop-->
  247. </xsl:template>
  248. <xsl:template match="listitem" mode="xref">
  249. <xsl:number format="1"/>
  250. </xsl:template>
  251. <xsl:template match="listitem/simpara" priority="2">
  252. <!-- If a listitem contains only a single simpara, don't output
  253. the <p> wrapper; this has the effect of creating an li
  254. with simple text content. -->
  255. <xsl:choose>
  256. <xsl:when test="not(preceding-sibling::*) and not (following-sibling::*)">
  257. <xsl:call-template name="anchor"/>
  258. <xsl:apply-templates/>
  259. </xsl:when>
  260. <xsl:otherwise>
  261. <p>
  262. <xsl:if test="@role and $para.propagates.style != 0">
  263. <xsl:apply-templates select="." mode="class.attribute">
  264. <xsl:with-param name="class" select="@role"/>
  265. </xsl:apply-templates>
  266. </xsl:if>
  267. <xsl:call-template name="anchor"/>
  268. <xsl:apply-templates/>
  269. </p>
  270. </xsl:otherwise>
  271. </xsl:choose>
  272. </xsl:template>
  273. <xsl:template match="varlistentry">
  274. <dt>
  275. <xsl:call-template name="anchor"/>
  276. <xsl:apply-templates select="term"/>
  277. </dt>
  278. <dd>
  279. <xsl:apply-templates select="listitem"/>
  280. </dd>
  281. </xsl:template>
  282. <xsl:template match="varlistentry" mode="varlist-table">
  283. <xsl:variable name="presentation">
  284. <xsl:call-template name="pi.dbhtml_term-presentation">
  285. <xsl:with-param name="node" select=".."/>
  286. </xsl:call-template>
  287. </xsl:variable>
  288. <xsl:variable name="separator">
  289. <xsl:call-template name="pi.dbhtml_term-separator">
  290. <xsl:with-param name="node" select=".."/>
  291. </xsl:call-template>
  292. </xsl:variable>
  293. <tr>
  294. <xsl:call-template name="tr.attributes">
  295. <xsl:with-param name="rownum">
  296. <xsl:number from="variablelist" count="varlistentry"/>
  297. </xsl:with-param>
  298. </xsl:call-template>
  299. <td>
  300. <p>
  301. <xsl:call-template name="anchor"/>
  302. <xsl:choose>
  303. <xsl:when test="$presentation = 'bold'">
  304. <b>
  305. <xsl:apply-templates select="term"/>
  306. <xsl:value-of select="$separator"/>
  307. </b>
  308. </xsl:when>
  309. <xsl:when test="$presentation = 'italic'">
  310. <i>
  311. <xsl:apply-templates select="term"/>
  312. <xsl:value-of select="$separator"/>
  313. </i>
  314. </xsl:when>
  315. <xsl:when test="$presentation = 'bold-italic'">
  316. <b>
  317. <i>
  318. <xsl:apply-templates select="term"/>
  319. <xsl:value-of select="$separator"/>
  320. </i>
  321. </b>
  322. </xsl:when>
  323. <xsl:otherwise>
  324. <xsl:apply-templates select="term"/>
  325. <xsl:value-of select="$separator"/>
  326. </xsl:otherwise>
  327. </xsl:choose>
  328. </p>
  329. </td>
  330. <td>
  331. <xsl:apply-templates select="listitem"/>
  332. </td>
  333. </tr>
  334. </xsl:template>
  335. <xsl:template match="varlistentry/term">
  336. <span class="term">
  337. <xsl:call-template name="anchor"/>
  338. <xsl:call-template name="simple.xlink">
  339. <xsl:with-param name="content">
  340. <xsl:apply-templates/>
  341. </xsl:with-param>
  342. </xsl:call-template>
  343. <xsl:choose>
  344. <xsl:when test="position() = last()"/> <!-- do nothing -->
  345. <xsl:otherwise>
  346. <!-- * if we have multiple terms in the same varlistentry, generate -->
  347. <!-- * a separator (", " by default) and/or an additional line -->
  348. <!-- * break after each one except the last -->
  349. <xsl:value-of select="$variablelist.term.separator"/>
  350. <xsl:if test="not($variablelist.term.break.after = '0')">
  351. <br/>
  352. </xsl:if>
  353. </xsl:otherwise>
  354. </xsl:choose>
  355. </span>
  356. </xsl:template>
  357. <xsl:template match="varlistentry/listitem">
  358. <!-- we can't just drop the anchor in since some browsers (Opera)
  359. get confused about line breaks if we do. So if the first child
  360. is a para, assume the para will put in the anchor. Otherwise,
  361. put the anchor in anyway. -->
  362. <xsl:if test="local-name(child::*[1]) != 'para'">
  363. <xsl:call-template name="anchor"/>
  364. </xsl:if>
  365. <xsl:choose>
  366. <xsl:when test="$show.revisionflag != 0 and @revisionflag">
  367. <div class="{@revisionflag}">
  368. <xsl:apply-templates/>
  369. </div>
  370. </xsl:when>
  371. <xsl:otherwise>
  372. <xsl:apply-templates/>
  373. </xsl:otherwise>
  374. </xsl:choose>
  375. </xsl:template>
  376. <!-- ==================================================================== -->
  377. <xsl:template match="simplelist">
  378. <!-- with no type specified, the default is 'vert' -->
  379. <xsl:call-template name="anchor"/>
  380. <table class="simplelist" border="0" summary="Simple list">
  381. <xsl:call-template name="simplelist.vert">
  382. <xsl:with-param name="cols">
  383. <xsl:choose>
  384. <xsl:when test="@columns">
  385. <xsl:value-of select="@columns"/>
  386. </xsl:when>
  387. <xsl:otherwise>1</xsl:otherwise>
  388. </xsl:choose>
  389. </xsl:with-param>
  390. </xsl:call-template>
  391. </table>
  392. </xsl:template>
  393. <xsl:template match="simplelist[@type='inline']">
  394. <span>
  395. <xsl:apply-templates select="." mode="class.attribute"/>
  396. <!-- if dbchoice PI exists, use that to determine the choice separator -->
  397. <!-- (that is, equivalent of "and" or "or" in current locale), or literal -->
  398. <!-- value of "choice" otherwise -->
  399. <xsl:variable name="localized-choice-separator">
  400. <xsl:choose>
  401. <xsl:when test="processing-instruction('dbchoice')">
  402. <xsl:call-template name="select.choice.separator"/>
  403. </xsl:when>
  404. <xsl:otherwise>
  405. <!-- empty -->
  406. </xsl:otherwise>
  407. </xsl:choose>
  408. </xsl:variable>
  409. <xsl:for-each select="member">
  410. <xsl:call-template name="simple.xlink">
  411. <xsl:with-param name="content">
  412. <xsl:apply-templates/>
  413. </xsl:with-param>
  414. </xsl:call-template>
  415. <xsl:choose>
  416. <xsl:when test="position() = last()"/> <!-- do nothing -->
  417. <xsl:otherwise>
  418. <xsl:text>, </xsl:text>
  419. <xsl:if test="position() = last() - 1">
  420. <xsl:if test="$localized-choice-separator != ''">
  421. <xsl:value-of select="$localized-choice-separator"/>
  422. <xsl:text> </xsl:text>
  423. </xsl:if>
  424. </xsl:if>
  425. </xsl:otherwise>
  426. </xsl:choose>
  427. </xsl:for-each>
  428. </span>
  429. </xsl:template>
  430. <xsl:template match="simplelist[@type='horiz']">
  431. <xsl:call-template name="anchor"/>
  432. <table class="simplelist" border="0" summary="Simple list">
  433. <xsl:call-template name="simplelist.horiz">
  434. <xsl:with-param name="cols">
  435. <xsl:choose>
  436. <xsl:when test="@columns">
  437. <xsl:value-of select="@columns"/>
  438. </xsl:when>
  439. <xsl:otherwise>1</xsl:otherwise>
  440. </xsl:choose>
  441. </xsl:with-param>
  442. </xsl:call-template>
  443. </table>
  444. </xsl:template>
  445. <xsl:template match="simplelist[@type='vert']">
  446. <xsl:call-template name="anchor"/>
  447. <table class="simplelist" border="0" summary="Simple list">
  448. <xsl:call-template name="simplelist.vert">
  449. <xsl:with-param name="cols">
  450. <xsl:choose>
  451. <xsl:when test="@columns">
  452. <xsl:value-of select="@columns"/>
  453. </xsl:when>
  454. <xsl:otherwise>1</xsl:otherwise>
  455. </xsl:choose>
  456. </xsl:with-param>
  457. </xsl:call-template>
  458. </table>
  459. </xsl:template>
  460. <xsl:template name="simplelist.horiz">
  461. <xsl:param name="cols">1</xsl:param>
  462. <xsl:param name="cell">1</xsl:param>
  463. <xsl:param name="members" select="./member"/>
  464. <xsl:if test="$cell &lt;= count($members)">
  465. <tr>
  466. <xsl:call-template name="tr.attributes">
  467. <xsl:with-param name="row" select="$members[1]"/>
  468. <xsl:with-param name="rownum" select="(($cell - 1) div $cols) + 1"/>
  469. </xsl:call-template>
  470. <xsl:call-template name="simplelist.horiz.row">
  471. <xsl:with-param name="cols" select="$cols"/>
  472. <xsl:with-param name="cell" select="$cell"/>
  473. <xsl:with-param name="members" select="$members"/>
  474. </xsl:call-template>
  475. </tr>
  476. <xsl:call-template name="simplelist.horiz">
  477. <xsl:with-param name="cols" select="$cols"/>
  478. <xsl:with-param name="cell" select="$cell + $cols"/>
  479. <xsl:with-param name="members" select="$members"/>
  480. </xsl:call-template>
  481. </xsl:if>
  482. </xsl:template>
  483. <xsl:template name="simplelist.horiz.row">
  484. <xsl:param name="cols">1</xsl:param>
  485. <xsl:param name="cell">1</xsl:param>
  486. <xsl:param name="members" select="./member"/>
  487. <xsl:param name="curcol">1</xsl:param>
  488. <xsl:if test="$curcol &lt;= $cols">
  489. <td>
  490. <xsl:choose>
  491. <xsl:when test="$members[position()=$cell]">
  492. <xsl:apply-templates select="$members[position()=$cell]"/>
  493. </xsl:when>
  494. <xsl:otherwise>
  495. <xsl:text>&#160;</xsl:text>
  496. </xsl:otherwise>
  497. </xsl:choose>
  498. </td>
  499. <xsl:call-template name="simplelist.horiz.row">
  500. <xsl:with-param name="cols" select="$cols"/>
  501. <xsl:with-param name="cell" select="$cell+1"/>
  502. <xsl:with-param name="members" select="$members"/>
  503. <xsl:with-param name="curcol" select="$curcol+1"/>
  504. </xsl:call-template>
  505. </xsl:if>
  506. </xsl:template>
  507. <xsl:template name="simplelist.vert">
  508. <xsl:param name="cols">1</xsl:param>
  509. <xsl:param name="cell">1</xsl:param>
  510. <xsl:param name="members" select="./member"/>
  511. <xsl:param name="rows" select="floor((count($members)+$cols - 1) div $cols)"/>
  512. <xsl:if test="$cell &lt;= $rows">
  513. <tr>
  514. <xsl:call-template name="tr.attributes">
  515. <xsl:with-param name="row" select="$members[1]"/>
  516. <xsl:with-param name="rownum" select="$cell"/>
  517. </xsl:call-template>
  518. <xsl:call-template name="simplelist.vert.row">
  519. <xsl:with-param name="cols" select="$cols"/>
  520. <xsl:with-param name="rows" select="$rows"/>
  521. <xsl:with-param name="cell" select="$cell"/>
  522. <xsl:with-param name="members" select="$members"/>
  523. </xsl:call-template>
  524. </tr>
  525. <xsl:call-template name="simplelist.vert">
  526. <xsl:with-param name="cols" select="$cols"/>
  527. <xsl:with-param name="cell" select="$cell+1"/>
  528. <xsl:with-param name="members" select="$members"/>
  529. <xsl:with-param name="rows" select="$rows"/>
  530. </xsl:call-template>
  531. </xsl:if>
  532. </xsl:template>
  533. <xsl:template name="simplelist.vert.row">
  534. <xsl:param name="cols">1</xsl:param>
  535. <xsl:param name="rows">1</xsl:param>
  536. <xsl:param name="cell">1</xsl:param>
  537. <xsl:param name="members" select="./member"/>
  538. <xsl:param name="curcol">1</xsl:param>
  539. <xsl:if test="$curcol &lt;= $cols">
  540. <td>
  541. <xsl:choose>
  542. <xsl:when test="$members[position()=$cell]">
  543. <xsl:apply-templates select="$members[position()=$cell]"/>
  544. </xsl:when>
  545. <xsl:otherwise>
  546. <xsl:text>&#160;</xsl:text>
  547. </xsl:otherwise>
  548. </xsl:choose>
  549. </td>
  550. <xsl:call-template name="simplelist.vert.row">
  551. <xsl:with-param name="cols" select="$cols"/>
  552. <xsl:with-param name="rows" select="$rows"/>
  553. <xsl:with-param name="cell" select="$cell+$rows"/>
  554. <xsl:with-param name="members" select="$members"/>
  555. <xsl:with-param name="curcol" select="$curcol+1"/>
  556. </xsl:call-template>
  557. </xsl:if>
  558. </xsl:template>
  559. <xsl:template match="member">
  560. <xsl:call-template name="anchor"/>
  561. <xsl:call-template name="simple.xlink">
  562. <xsl:with-param name="content">
  563. <xsl:apply-templates/>
  564. </xsl:with-param>
  565. </xsl:call-template>
  566. </xsl:template>
  567. <!-- ==================================================================== -->
  568. <xsl:template match="procedure">
  569. <xsl:variable name="param.placement" select="substring-after(normalize-space($formal.title.placement), concat(local-name(.), ' '))"/>
  570. <xsl:variable name="placement">
  571. <xsl:choose>
  572. <xsl:when test="contains($param.placement, ' ')">
  573. <xsl:value-of select="substring-before($param.placement, ' ')"/>
  574. </xsl:when>
  575. <xsl:when test="$param.placement = ''">before</xsl:when>
  576. <xsl:otherwise>
  577. <xsl:value-of select="$param.placement"/>
  578. </xsl:otherwise>
  579. </xsl:choose>
  580. </xsl:variable>
  581. <!-- Preserve order of PIs and comments -->
  582. <xsl:variable name="preamble" select="*[not(self::step or self::title or self::titleabbrev)] |comment()[not(preceding-sibling::step)] |processing-instruction()[not(preceding-sibling::step)]"/>
  583. <div>
  584. <xsl:apply-templates select="." mode="class.attribute"/>
  585. <xsl:call-template name="anchor">
  586. <xsl:with-param name="conditional">
  587. <xsl:choose>
  588. <xsl:when test="title">0</xsl:when>
  589. <xsl:otherwise>1</xsl:otherwise>
  590. </xsl:choose>
  591. </xsl:with-param>
  592. </xsl:call-template>
  593. <xsl:if test="title and $placement = 'before'">
  594. <xsl:call-template name="formal.object.heading"/>
  595. </xsl:if>
  596. <xsl:apply-templates select="$preamble"/>
  597. <xsl:choose>
  598. <xsl:when test="count(step) = 1">
  599. <ul>
  600. <xsl:apply-templates select="step |comment()[preceding-sibling::step] |processing-instruction()[preceding-sibling::step]"/>
  601. </ul>
  602. </xsl:when>
  603. <xsl:otherwise>
  604. <ol>
  605. <xsl:attribute name="type">
  606. <xsl:value-of select="substring($procedure.step.numeration.formats,1,1)"/>
  607. </xsl:attribute>
  608. <xsl:apply-templates select="step |comment()[preceding-sibling::step] |processing-instruction()[preceding-sibling::step]"/>
  609. </ol>
  610. </xsl:otherwise>
  611. </xsl:choose>
  612. <xsl:if test="title and $placement != 'before'">
  613. <xsl:call-template name="formal.object.heading"/>
  614. </xsl:if>
  615. </div>
  616. </xsl:template>
  617. <xsl:template match="procedure/title">
  618. <!-- nop -->
  619. </xsl:template>
  620. <xsl:template match="substeps">
  621. <xsl:variable name="numeration">
  622. <xsl:call-template name="procedure.step.numeration"/>
  623. </xsl:variable>
  624. <xsl:call-template name="anchor"/>
  625. <ol type="{$numeration}">
  626. <xsl:apply-templates/>
  627. </ol>
  628. </xsl:template>
  629. <xsl:template match="step">
  630. <li>
  631. <xsl:call-template name="anchor"/>
  632. <xsl:apply-templates/>
  633. </li>
  634. </xsl:template>
  635. <xsl:template match="stepalternatives">
  636. <xsl:call-template name="anchor"/>
  637. <ul>
  638. <xsl:apply-templates/>
  639. </ul>
  640. </xsl:template>
  641. <xsl:template match="step/title">
  642. <p class="title">
  643. <b>
  644. <xsl:apply-templates/>
  645. </b>
  646. </p>
  647. </xsl:template>
  648. <!-- ==================================================================== -->
  649. <xsl:template match="segmentedlist">
  650. <xsl:variable name="presentation">
  651. <xsl:call-template name="pi.dbhtml_list-presentation"/>
  652. </xsl:variable>
  653. <div>
  654. <xsl:apply-templates select="." mode="class.attribute"/>
  655. <xsl:call-template name="anchor"/>
  656. <xsl:choose>
  657. <xsl:when test="$presentation = 'table'">
  658. <xsl:apply-templates select="." mode="seglist-table"/>
  659. </xsl:when>
  660. <xsl:when test="$presentation = 'list'">
  661. <xsl:apply-templates/>
  662. </xsl:when>
  663. <xsl:when test="$segmentedlist.as.table != 0">
  664. <xsl:apply-templates select="." mode="seglist-table"/>
  665. </xsl:when>
  666. <xsl:otherwise>
  667. <xsl:apply-templates/>
  668. </xsl:otherwise>
  669. </xsl:choose>
  670. </div>
  671. </xsl:template>
  672. <xsl:template match="segmentedlist/title">
  673. <div class="title">
  674. <strong><span class="title"><xsl:apply-templates/></span></strong>
  675. </div>
  676. </xsl:template>
  677. <xsl:template match="segtitle">
  678. </xsl:template>
  679. <xsl:template match="segtitle" mode="segtitle-in-seg">
  680. <xsl:apply-templates/>
  681. </xsl:template>
  682. <xsl:template match="seglistitem">
  683. <div class="seglistitem">
  684. <xsl:call-template name="anchor"/>
  685. <xsl:apply-templates/>
  686. </div>
  687. </xsl:template>
  688. <xsl:template match="seg">
  689. <xsl:variable name="segnum" select="count(preceding-sibling::seg)+1"/>
  690. <xsl:variable name="seglist" select="ancestor::segmentedlist"/>
  691. <xsl:variable name="segtitles" select="$seglist/segtitle"/>
  692. <!--
  693. Note: segtitle is only going to be the right thing in a well formed
  694. SegmentedList. If there are too many Segs or too few SegTitles,
  695. you'll get something odd...maybe an error
  696. -->
  697. <div class="seg">
  698. <strong>
  699. <span class="segtitle">
  700. <xsl:apply-templates select="$segtitles[$segnum=position()]" mode="segtitle-in-seg"/>
  701. <xsl:text>: </xsl:text>
  702. </span>
  703. </strong>
  704. <xsl:apply-templates/>
  705. </div>
  706. </xsl:template>
  707. <xsl:template match="segmentedlist" mode="seglist-table">
  708. <xsl:variable name="table-summary">
  709. <xsl:call-template name="pi.dbhtml_table-summary"/>
  710. </xsl:variable>
  711. <xsl:variable name="list-width">
  712. <xsl:call-template name="pi.dbhtml_list-width"/>
  713. </xsl:variable>
  714. <xsl:apply-templates select="title"/>
  715. <table border="0">
  716. <xsl:if test="$list-width != ''">
  717. <xsl:attribute name="width">
  718. <xsl:value-of select="$list-width"/>
  719. </xsl:attribute>
  720. </xsl:if>
  721. <xsl:if test="$table-summary != ''">
  722. <xsl:attribute name="summary">
  723. <xsl:value-of select="$table-summary"/>
  724. </xsl:attribute>
  725. </xsl:if>
  726. <thead>
  727. <tr class="segtitle">
  728. <xsl:call-template name="tr.attributes">
  729. <xsl:with-param name="row" select="segtitle[1]"/>
  730. <xsl:with-param name="rownum" select="1"/>
  731. </xsl:call-template>
  732. <xsl:apply-templates select="segtitle" mode="seglist-table"/>
  733. </tr>
  734. </thead>
  735. <tbody>
  736. <xsl:apply-templates select="seglistitem" mode="seglist-table"/>
  737. </tbody>
  738. </table>
  739. </xsl:template>
  740. <xsl:template match="segtitle" mode="seglist-table">
  741. <th><xsl:apply-templates/></th>
  742. </xsl:template>
  743. <xsl:template match="seglistitem" mode="seglist-table">
  744. <xsl:variable name="seglinum">
  745. <xsl:number from="segmentedlist" count="seglistitem"/>
  746. </xsl:variable>
  747. <tr class="seglistitem">
  748. <xsl:call-template name="tr.attributes">
  749. <xsl:with-param name="rownum" select="$seglinum + 1"/>
  750. </xsl:call-template>
  751. <xsl:apply-templates mode="seglist-table"/>
  752. </tr>
  753. </xsl:template>
  754. <xsl:template match="seg" mode="seglist-table">
  755. <td class="seg"><xsl:apply-templates/></td>
  756. </xsl:template>
  757. <xsl:template match="seg[1]" mode="seglist-table">
  758. <td class="seg">
  759. <xsl:call-template name="anchor">
  760. <xsl:with-param name="node" select="ancestor::seglistitem"/>
  761. </xsl:call-template>
  762. <xsl:apply-templates/>
  763. </td>
  764. </xsl:template>
  765. <!-- ==================================================================== -->
  766. <xsl:template match="calloutlist">
  767. <div>
  768. <xsl:apply-templates select="." mode="class.attribute"/>
  769. <xsl:call-template name="anchor"/>
  770. <xsl:if test="title|info/title">
  771. <xsl:call-template name="formal.object.heading"/>
  772. </xsl:if>
  773. <!-- Preserve order of PIs and comments -->
  774. <xsl:apply-templates select="*[not(self::callout or self::title or self::titleabbrev)] |comment()[not(preceding-sibling::callout)] |processing-instruction()[not(preceding-sibling::callout)]"/>
  775. <xsl:choose>
  776. <xsl:when test="$callout.list.table != 0">
  777. <table border="0" summary="Callout list">
  778. <xsl:apply-templates select="callout |comment()[preceding-sibling::callout] |processing-instruction()[preceding-sibling::callout]"/>
  779. </table>
  780. </xsl:when>
  781. <xsl:otherwise>
  782. <dl compact="compact">
  783. <xsl:apply-templates select="callout |comment()[preceding-sibling::callout] |processing-instruction()[preceding-sibling::callout]"/>
  784. </dl>
  785. </xsl:otherwise>
  786. </xsl:choose>
  787. </div>
  788. </xsl:template>
  789. <xsl:template match="calloutlist/title">
  790. </xsl:template>
  791. <xsl:template match="callout">
  792. <xsl:choose>
  793. <xsl:when test="$callout.list.table != 0">
  794. <tr>
  795. <xsl:call-template name="tr.attributes">
  796. <xsl:with-param name="rownum">
  797. <xsl:number from="calloutlist" count="callout"/>
  798. </xsl:with-param>
  799. </xsl:call-template>
  800. <td width="5%" valign="top" align="left">
  801. <p>
  802. <xsl:call-template name="anchor"/>
  803. <xsl:call-template name="callout.arearefs">
  804. <xsl:with-param name="arearefs" select="@arearefs"/>
  805. </xsl:call-template>
  806. </p>
  807. </td>
  808. <td valign="top" align="left">
  809. <xsl:apply-templates/>
  810. </td>
  811. </tr>
  812. </xsl:when>
  813. <xsl:otherwise>
  814. <dt>
  815. <xsl:call-template name="anchor"/>
  816. <xsl:call-template name="callout.arearefs">
  817. <xsl:with-param name="arearefs" select="@arearefs"/>
  818. </xsl:call-template>
  819. </dt>
  820. <dd><xsl:apply-templates/></dd>
  821. </xsl:otherwise>
  822. </xsl:choose>
  823. </xsl:template>
  824. <xsl:template match="callout/simpara" priority="2">
  825. <!-- If a callout contains only a single simpara, don't output
  826. the <p> wrapper; this has the effect of creating an li
  827. with simple text content. -->
  828. <xsl:choose>
  829. <xsl:when test="not(preceding-sibling::*) and not (following-sibling::*)">
  830. <xsl:call-template name="anchor"/>
  831. <xsl:apply-templates/>
  832. </xsl:when>
  833. <xsl:otherwise>
  834. <p>
  835. <xsl:if test="@role and $para.propagates.style != 0">
  836. <xsl:apply-templates select="." mode="class.attribute">
  837. <xsl:with-param name="class" select="@role"/>
  838. </xsl:apply-templates>
  839. </xsl:if>
  840. <xsl:call-template name="anchor"/>
  841. <xsl:apply-templates/>
  842. </p>
  843. </xsl:otherwise>
  844. </xsl:choose>
  845. </xsl:template>
  846. <xsl:template name="callout.arearefs">
  847. <xsl:param name="arearefs"/>
  848. <xsl:if test="$arearefs!=''">
  849. <xsl:choose>
  850. <xsl:when test="substring-before($arearefs,' ')=''">
  851. <xsl:call-template name="callout.arearef">
  852. <xsl:with-param name="arearef" select="$arearefs"/>
  853. </xsl:call-template>
  854. </xsl:when>
  855. <xsl:otherwise>
  856. <xsl:call-template name="callout.arearef">
  857. <xsl:with-param name="arearef" select="substring-before($arearefs,' ')"/>
  858. </xsl:call-template>
  859. </xsl:otherwise>
  860. </xsl:choose>
  861. <xsl:call-template name="callout.arearefs">
  862. <xsl:with-param name="arearefs" select="substring-after($arearefs,' ')"/>
  863. </xsl:call-template>
  864. </xsl:if>
  865. </xsl:template>
  866. <xsl:template name="callout.arearef">
  867. <xsl:param name="arearef"/>
  868. <xsl:variable name="targets" select="key('id',$arearef)"/>
  869. <xsl:variable name="target" select="$targets[1]"/>
  870. <xsl:call-template name="check.id.unique">
  871. <xsl:with-param name="linkend" select="$arearef"/>
  872. </xsl:call-template>
  873. <xsl:choose>
  874. <xsl:when test="count($target)=0">
  875. <xsl:text>???</xsl:text>
  876. </xsl:when>
  877. <xsl:when test="local-name($target)='co'">
  878. <a>
  879. <xsl:attribute name="href">
  880. <xsl:text>#</xsl:text>
  881. <xsl:value-of select="$arearef"/>
  882. </xsl:attribute>
  883. <xsl:apply-templates select="$target" mode="callout-bug"/>
  884. </a>
  885. <xsl:text> </xsl:text>
  886. </xsl:when>
  887. <xsl:when test="local-name($target)='areaset'">
  888. <xsl:call-template name="callout-bug">
  889. <xsl:with-param name="conum">
  890. <xsl:apply-templates select="$target" mode="conumber"/>
  891. </xsl:with-param>
  892. </xsl:call-template>
  893. </xsl:when>
  894. <xsl:when test="local-name($target)='area'">
  895. <xsl:choose>
  896. <xsl:when test="$target/parent::areaset">
  897. <xsl:call-template name="callout-bug">
  898. <xsl:with-param name="conum">
  899. <xsl:apply-templates select="$target/parent::areaset" mode="conumber"/>
  900. </xsl:with-param>
  901. </xsl:call-template>
  902. </xsl:when>
  903. <xsl:otherwise>
  904. <xsl:call-template name="callout-bug">
  905. <xsl:with-param name="conum">
  906. <xsl:apply-templates select="$target" mode="conumber"/>
  907. </xsl:with-param>
  908. </xsl:call-template>
  909. </xsl:otherwise>
  910. </xsl:choose>
  911. </xsl:when>
  912. <xsl:otherwise>
  913. <xsl:text>???</xsl:text>
  914. </xsl:otherwise>
  915. </xsl:choose>
  916. </xsl:template>
  917. <!-- ==================================================================== -->
  918. <xsl:template name="orderedlist-starting-number">
  919. <xsl:param name="list" select="."/>
  920. <xsl:variable name="pi-start">
  921. <xsl:call-template name="pi.dbhtml_start">
  922. <xsl:with-param name="node" select="$list"/>
  923. </xsl:call-template>
  924. </xsl:variable>
  925. <xsl:call-template name="output-orderedlist-starting-number">
  926. <xsl:with-param name="list" select="$list"/>
  927. <xsl:with-param name="pi-start" select="$pi-start"/>
  928. </xsl:call-template>
  929. </xsl:template>
  930. </xsl:stylesheet>