block.xsl 17 KB

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