lists.xsl 34 KB

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