block.xsl 17 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579
  1. <?xml version="1.0" encoding="ASCII"?><!--This file was created automatically by html2xhtml--><!--from the HTML stylesheets.--><xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns="http://www.w3.org/1999/xhtml" version="1.0">
  2. <!-- ********************************************************************
  3. $Id: block.xsl 9667 2012-11-26 23:10:44Z bobstayton $
  4. ********************************************************************
  5. This file is part of the XSL DocBook Stylesheet distribution.
  6. See ../README or http://docbook.sf.net/release/xsl/current/ for
  7. copyright and other information.
  8. ******************************************************************** -->
  9. <!-- ==================================================================== -->
  10. <!-- What should we do about styling blockinfo? -->
  11. <xsl:template match="blockinfo|info">
  12. <!-- suppress -->
  13. </xsl:template>
  14. <!-- ==================================================================== -->
  15. <xsl:template name="block.object">
  16. <div>
  17. <xsl:call-template name="common.html.attributes"/>
  18. <xsl:call-template name="id.attribute"/>
  19. <xsl:call-template name="anchor"/>
  20. <xsl:apply-templates/>
  21. </div>
  22. </xsl:template>
  23. <!-- ==================================================================== -->
  24. <xsl:template match="para">
  25. <xsl:call-template name="paragraph">
  26. <xsl:with-param name="class">
  27. <xsl:if test="@role and $para.propagates.style != 0">
  28. <xsl:value-of select="@role"/>
  29. </xsl:if>
  30. </xsl:with-param>
  31. <xsl:with-param name="content">
  32. <xsl:if test="position() = 1 and parent::listitem">
  33. <xsl:call-template name="anchor">
  34. <xsl:with-param name="node" select="parent::listitem"/>
  35. </xsl:call-template>
  36. </xsl:if>
  37. <xsl:call-template name="anchor"/>
  38. <xsl:apply-templates/>
  39. </xsl:with-param>
  40. </xsl:call-template>
  41. </xsl:template>
  42. <xsl:template name="paragraph">
  43. <xsl:param name="class" select="''"/>
  44. <xsl:param name="content"/>
  45. <xsl:variable name="p">
  46. <p>
  47. <xsl:call-template name="id.attribute"/>
  48. <xsl:choose>
  49. <xsl:when test="$class != ''">
  50. <xsl:call-template name="common.html.attributes">
  51. <xsl:with-param name="class" select="$class"/>
  52. </xsl:call-template>
  53. </xsl:when>
  54. <xsl:otherwise>
  55. <xsl:call-template name="common.html.attributes">
  56. <xsl:with-param name="class" select="''"/>
  57. </xsl:call-template>
  58. </xsl:otherwise>
  59. </xsl:choose>
  60. <xsl:copy-of select="$content"/>
  61. </p>
  62. </xsl:variable>
  63. <xsl:choose>
  64. <xsl:when test="$html.cleanup != 0">
  65. <xsl:call-template name="unwrap.p">
  66. <xsl:with-param name="p" select="$p"/>
  67. </xsl:call-template>
  68. </xsl:when>
  69. <xsl:otherwise>
  70. <xsl:copy-of select="$p"/>
  71. </xsl:otherwise>
  72. </xsl:choose>
  73. </xsl:template>
  74. <xsl:template match="simpara">
  75. <!-- see also listitem/simpara in lists.xsl -->
  76. <p>
  77. <xsl:call-template name="id.attribute"/>
  78. <xsl:call-template name="locale.html.attributes"/>
  79. <xsl:if test="@role and $para.propagates.style != 0">
  80. <xsl:apply-templates select="." mode="class.attribute">
  81. <xsl:with-param name="class" select="@role"/>
  82. </xsl:apply-templates>
  83. </xsl:if>
  84. <xsl:call-template name="anchor"/>
  85. <xsl:apply-templates/>
  86. </p>
  87. </xsl:template>
  88. <xsl:template match="formalpara">
  89. <xsl:call-template name="paragraph">
  90. <xsl:with-param name="class">
  91. <xsl:if test="@role and $para.propagates.style != 0">
  92. <xsl:value-of select="@role"/>
  93. </xsl:if>
  94. </xsl:with-param>
  95. <xsl:with-param name="content">
  96. <xsl:call-template name="anchor"/>
  97. <xsl:apply-templates/>
  98. </xsl:with-param>
  99. </xsl:call-template>
  100. </xsl:template>
  101. <!-- Only use title from info -->
  102. <xsl:template match="formalpara/info">
  103. <xsl:apply-templates select="title"/>
  104. </xsl:template>
  105. <xsl:template match="formalpara/title|formalpara/info/title">
  106. <xsl:variable name="titleStr">
  107. <xsl:apply-templates/>
  108. </xsl:variable>
  109. <xsl:variable name="lastChar">
  110. <xsl:if test="$titleStr != ''">
  111. <xsl:value-of select="substring($titleStr,string-length($titleStr),1)"/>
  112. </xsl:if>
  113. </xsl:variable>
  114. <xsl:choose>
  115. <xsl:when test="$make.clean.html != 0">
  116. <span class="formalpara-title">
  117. <xsl:copy-of select="$titleStr"/>
  118. <xsl:if test="$lastChar != '' and not(contains($runinhead.title.end.punct, $lastChar))">
  119. <xsl:value-of select="$runinhead.default.title.end.punct"/>
  120. </xsl:if>
  121. <xsl:text>&#160;</xsl:text>
  122. </span>
  123. </xsl:when>
  124. <xsl:otherwise>
  125. <strong>
  126. <xsl:copy-of select="$titleStr"/>
  127. <xsl:if test="$lastChar != '' and not(contains($runinhead.title.end.punct, $lastChar))">
  128. <xsl:value-of select="$runinhead.default.title.end.punct"/>
  129. </xsl:if>
  130. <xsl:text>&#160;</xsl:text>
  131. </strong>
  132. </xsl:otherwise>
  133. </xsl:choose>
  134. </xsl:template>
  135. <xsl:template match="formalpara/para">
  136. <xsl:apply-templates/>
  137. </xsl:template>
  138. <!-- ==================================================================== -->
  139. <xsl:template match="blockquote">
  140. <div>
  141. <xsl:call-template name="common.html.attributes"/>
  142. <xsl:call-template name="id.attribute"/>
  143. <xsl:call-template name="anchor"/>
  144. <xsl:choose>
  145. <xsl:when test="attribution">
  146. <table border="{$table.border.off}" class="blockquote">
  147. <xsl:if test="$css.decoration != 0">
  148. <xsl:attribute name="style">
  149. <xsl:text>width: 100%; cellspacing: 0; cellpadding: 0;</xsl:text>
  150. </xsl:attribute>
  151. </xsl:if>
  152. <xsl:if test="$div.element != 'section'">
  153. <xsl:attribute name="summary">Block quote</xsl:attribute>
  154. </xsl:if>
  155. <tr>
  156. <td valign="top">&#160;</td>
  157. <td valign="top">
  158. <xsl:apply-templates select="child::*[local-name(.)!='attribution']"/>
  159. </td>
  160. <td valign="top">&#160;</td>
  161. </tr>
  162. <tr>
  163. <td valign="top">&#160;</td>
  164. <td colspan="2" align="{$direction.align.end}" valign="top">
  165. <xsl:text>--</xsl:text>
  166. <xsl:apply-templates select="attribution"/>
  167. </td>
  168. </tr>
  169. </table>
  170. </xsl:when>
  171. <xsl:otherwise>
  172. <blockquote>
  173. <xsl:call-template name="common.html.attributes"/>
  174. <xsl:apply-templates/>
  175. </blockquote>
  176. </xsl:otherwise>
  177. </xsl:choose>
  178. </div>
  179. </xsl:template>
  180. <xsl:template match="blockquote/title|blockquote/info/title">
  181. <xsl:choose>
  182. <xsl:when test="$make.clean.html != 0">
  183. <div class="blockquote-title">
  184. <xsl:apply-templates/>
  185. </div>
  186. </xsl:when>
  187. <xsl:otherwise>
  188. <div class="blockquote-title">
  189. <p>
  190. <strong>
  191. <xsl:apply-templates/>
  192. </strong>
  193. </p>
  194. </div>
  195. </xsl:otherwise>
  196. </xsl:choose>
  197. </xsl:template>
  198. <!-- Use an em dash per Chicago Manual of Style and https://sourceforge.net/tracker/index.php?func=detail&aid=2793878&group_id=21935&atid=373747 -->
  199. <xsl:template match="epigraph">
  200. <div>
  201. <xsl:call-template name="common.html.attributes"/>
  202. <xsl:call-template name="id.attribute"/>
  203. <xsl:apply-templates select="para|simpara|formalpara|literallayout"/>
  204. <xsl:if test="attribution">
  205. <div class="attribution">
  206. <span>&#8212;<xsl:apply-templates select="attribution"/></span>
  207. </div>
  208. </xsl:if>
  209. </div>
  210. </xsl:template>
  211. <xsl:template match="attribution">
  212. <span>
  213. <xsl:call-template name="common.html.attributes"/>
  214. <xsl:call-template name="id.attribute"/>
  215. <xsl:apply-templates/>
  216. </span>
  217. </xsl:template>
  218. <!-- ==================================================================== -->
  219. <xsl:template match="sidebar">
  220. <div>
  221. <xsl:call-template name="common.html.attributes"/>
  222. <xsl:call-template name="id.attribute"/>
  223. <xsl:call-template name="anchor"/>
  224. <xsl:call-template name="sidebar.titlepage"/>
  225. <xsl:apply-templates/>
  226. </div>
  227. </xsl:template>
  228. <xsl:template match="abstract/title|sidebar/title">
  229. </xsl:template>
  230. <xsl:template match="sidebar/sidebarinfo|sidebar/info"/>
  231. <xsl:template match="abstract">
  232. <div>
  233. <xsl:call-template name="common.html.attributes"/>
  234. <xsl:call-template name="anchor"/>
  235. <xsl:call-template name="formal.object.heading">
  236. <xsl:with-param name="title">
  237. <xsl:apply-templates select="." mode="title.markup">
  238. <xsl:with-param name="allow-anchors" select="'1'"/>
  239. </xsl:apply-templates>
  240. </xsl:with-param>
  241. </xsl:call-template>
  242. <xsl:apply-templates/>
  243. </div>
  244. </xsl:template>
  245. <!-- ==================================================================== -->
  246. <xsl:template match="msgset">
  247. <xsl:apply-templates/>
  248. </xsl:template>
  249. <xsl:template match="msgentry">
  250. <xsl:call-template name="block.object"/>
  251. </xsl:template>
  252. <xsl:template match="simplemsgentry">
  253. <xsl:call-template name="block.object"/>
  254. </xsl:template>
  255. <xsl:template match="msg">
  256. <xsl:call-template name="block.object"/>
  257. </xsl:template>
  258. <xsl:template match="msgmain">
  259. <xsl:apply-templates/>
  260. </xsl:template>
  261. <xsl:template match="msgmain/title">
  262. <xsl:choose>
  263. <xsl:when test="$make.clean.html != 0">
  264. <span class="msgmain-title">
  265. <xsl:apply-templates/>
  266. </span>
  267. </xsl:when>
  268. <xsl:otherwise>
  269. <strong><xsl:apply-templates/></strong>
  270. </xsl:otherwise>
  271. </xsl:choose>
  272. </xsl:template>
  273. <xsl:template match="msgsub">
  274. <xsl:apply-templates/>
  275. </xsl:template>
  276. <xsl:template match="msgsub/title">
  277. <xsl:choose>
  278. <xsl:when test="$make.clean.html != 0">
  279. <span class="msgsub-title">
  280. <xsl:apply-templates/>
  281. </span>
  282. </xsl:when>
  283. <xsl:otherwise>
  284. <strong><xsl:apply-templates/></strong>
  285. </xsl:otherwise>
  286. </xsl:choose>
  287. </xsl:template>
  288. <xsl:template match="msgrel">
  289. <xsl:apply-templates/>
  290. </xsl:template>
  291. <xsl:template match="msgrel/title">
  292. <xsl:choose>
  293. <xsl:when test="$make.clean.html != 0">
  294. <span class="msgrel-title">
  295. <xsl:apply-templates/>
  296. </span>
  297. </xsl:when>
  298. <xsl:otherwise>
  299. <strong><xsl:apply-templates/></strong>
  300. </xsl:otherwise>
  301. </xsl:choose>
  302. </xsl:template>
  303. <xsl:template match="msgtext">
  304. <xsl:apply-templates/>
  305. </xsl:template>
  306. <xsl:template match="msginfo">
  307. <xsl:call-template name="block.object"/>
  308. </xsl:template>
  309. <xsl:template match="msglevel">
  310. <xsl:choose>
  311. <xsl:when test="$make.clean.html != 0">
  312. <div class="msglevel">
  313. <span class="msglevel-title">
  314. <xsl:call-template name="gentext.template">
  315. <xsl:with-param name="context" select="'msgset'"/>
  316. <xsl:with-param name="name" select="'MsgLevel'"/>
  317. </xsl:call-template>
  318. </span>
  319. <xsl:apply-templates/>
  320. </div>
  321. </xsl:when>
  322. <xsl:otherwise>
  323. <p>
  324. <strong>
  325. <xsl:call-template name="gentext.template">
  326. <xsl:with-param name="context" select="'msgset'"/>
  327. <xsl:with-param name="name" select="'MsgLevel'"/>
  328. </xsl:call-template>
  329. </strong>
  330. <xsl:apply-templates/>
  331. </p>
  332. </xsl:otherwise>
  333. </xsl:choose>
  334. </xsl:template>
  335. <xsl:template match="msgorig">
  336. <xsl:choose>
  337. <xsl:when test="$make.clean.html != 0">
  338. <div class="msgorig">
  339. <span class="msgorig-title">
  340. <xsl:call-template name="gentext.template">
  341. <xsl:with-param name="context" select="'msgset'"/>
  342. <xsl:with-param name="name" select="'MsgOrig'"/>
  343. </xsl:call-template>
  344. </span>
  345. <xsl:apply-templates/>
  346. </div>
  347. </xsl:when>
  348. <xsl:otherwise>
  349. <p>
  350. <strong>
  351. <xsl:call-template name="gentext.template">
  352. <xsl:with-param name="context" select="'msgset'"/>
  353. <xsl:with-param name="name" select="'MsgOrig'"/>
  354. </xsl:call-template>
  355. </strong>
  356. <xsl:apply-templates/>
  357. </p>
  358. </xsl:otherwise>
  359. </xsl:choose>
  360. </xsl:template>
  361. <xsl:template match="msgaud">
  362. <xsl:choose>
  363. <xsl:when test="$make.clean.html != 0">
  364. <div class="msgaud">
  365. <span class="msgaud-title">
  366. <xsl:call-template name="gentext.template">
  367. <xsl:with-param name="context" select="'msgset'"/>
  368. <xsl:with-param name="name" select="'MsgAud'"/>
  369. </xsl:call-template>
  370. </span>
  371. <xsl:apply-templates/>
  372. </div>
  373. </xsl:when>
  374. <xsl:otherwise>
  375. <p>
  376. <strong>
  377. <xsl:call-template name="gentext.template">
  378. <xsl:with-param name="context" select="'msgset'"/>
  379. <xsl:with-param name="name" select="'MsgAud'"/>
  380. </xsl:call-template>
  381. </strong>
  382. <xsl:apply-templates/>
  383. </p>
  384. </xsl:otherwise>
  385. </xsl:choose>
  386. </xsl:template>
  387. <xsl:template match="msgexplan">
  388. <xsl:call-template name="block.object"/>
  389. </xsl:template>
  390. <xsl:template match="msgexplan/title">
  391. <xsl:choose>
  392. <xsl:when test="$make.clean.html != 0">
  393. <div class="msgexplan">
  394. <span class="msgexplan-title">
  395. <xsl:apply-templates/>
  396. </span>
  397. </div>
  398. </xsl:when>
  399. <xsl:otherwise>
  400. <p>
  401. <strong>
  402. <xsl:apply-templates/>
  403. </strong>
  404. </p>
  405. </xsl:otherwise>
  406. </xsl:choose>
  407. </xsl:template>
  408. <!-- ==================================================================== -->
  409. <xsl:template match="revhistory">
  410. <div>
  411. <xsl:call-template name="common.html.attributes"/>
  412. <xsl:call-template name="id.attribute"/>
  413. <table>
  414. <xsl:if test="$css.decoration != 0">
  415. <xsl:attribute name="style">
  416. <xsl:text>border-style:solid; width:100%;</xsl:text>
  417. </xsl:attribute>
  418. </xsl:if>
  419. <!-- include summary attribute if not HTML5 -->
  420. <xsl:if test="$div.element != 'section'">
  421. <xsl:attribute name="summary">
  422. <xsl:call-template name="gentext">
  423. <xsl:with-param name="key">revhistory</xsl:with-param>
  424. </xsl:call-template>
  425. </xsl:attribute>
  426. </xsl:if>
  427. <tr>
  428. <th align="{$direction.align.start}" valign="top" colspan="3">
  429. <strong>
  430. <xsl:call-template name="gentext">
  431. <xsl:with-param name="key" select="'RevHistory'"/>
  432. </xsl:call-template>
  433. </strong>
  434. </th>
  435. </tr>
  436. <xsl:apply-templates/>
  437. </table>
  438. </div>
  439. </xsl:template>
  440. <xsl:template match="revhistory/revision">
  441. <xsl:variable name="revnumber" select="revnumber"/>
  442. <xsl:variable name="revdate" select="date"/>
  443. <xsl:variable name="revauthor" select="authorinitials|author"/>
  444. <xsl:variable name="revremark" select="revremark|revdescription"/>
  445. <tr>
  446. <td align="{$direction.align.start}">
  447. <xsl:if test="$revnumber">
  448. <xsl:call-template name="gentext">
  449. <xsl:with-param name="key" select="'Revision'"/>
  450. </xsl:call-template>
  451. <xsl:call-template name="gentext.space"/>
  452. <xsl:apply-templates select="$revnumber"/>
  453. </xsl:if>
  454. </td>
  455. <td align="{$direction.align.start}">
  456. <xsl:apply-templates select="$revdate"/>
  457. </td>
  458. <xsl:choose>
  459. <xsl:when test="count($revauthor)=0">
  460. <td align="{$direction.align.start}">
  461. <xsl:call-template name="dingbat">
  462. <xsl:with-param name="dingbat">nbsp</xsl:with-param>
  463. </xsl:call-template>
  464. </td>
  465. </xsl:when>
  466. <xsl:otherwise>
  467. <td align="{$direction.align.start}">
  468. <xsl:for-each select="$revauthor">
  469. <xsl:apply-templates select="."/>
  470. <xsl:if test="position() != last()">
  471. <xsl:text>, </xsl:text>
  472. </xsl:if>
  473. </xsl:for-each>
  474. </td>
  475. </xsl:otherwise>
  476. </xsl:choose>
  477. </tr>
  478. <xsl:if test="$revremark">
  479. <tr>
  480. <td align="{$direction.align.start}" colspan="3">
  481. <xsl:apply-templates select="$revremark"/>
  482. </td>
  483. </tr>
  484. </xsl:if>
  485. </xsl:template>
  486. <xsl:template match="revision/revnumber">
  487. <xsl:apply-templates/>
  488. </xsl:template>
  489. <xsl:template match="revision/date">
  490. <xsl:apply-templates/>
  491. </xsl:template>
  492. <xsl:template match="revision/authorinitials">
  493. <xsl:text>, </xsl:text>
  494. <xsl:apply-templates/>
  495. </xsl:template>
  496. <xsl:template match="revision/authorinitials[1]" priority="2">
  497. <xsl:apply-templates/>
  498. </xsl:template>
  499. <xsl:template match="revision/revremark">
  500. <xsl:apply-templates/>
  501. </xsl:template>
  502. <xsl:template match="revision/revdescription">
  503. <xsl:apply-templates/>
  504. </xsl:template>
  505. <!-- ==================================================================== -->
  506. <xsl:template match="ackno|acknowledgements[parent::article]">
  507. <xsl:call-template name="block.object"/>
  508. </xsl:template>
  509. <!-- ==================================================================== -->
  510. <xsl:template match="highlights">
  511. <xsl:call-template name="block.object"/>
  512. </xsl:template>
  513. <!-- ==================================================================== -->
  514. </xsl:stylesheet>