lists.xsl 34 KB

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