PageRenderTime 48ms CodeModel.GetById 18ms RepoModel.GetById 0ms app.codeStats 0ms

/build-support/trunk/users-guide.xsl

#
Extensible Stylesheet Language Transformations | 419 lines | 367 code | 52 blank | 0 comment | 0 complexity | b2500b5232a071a5f7463f05821e582e MD5 | raw file
Possible License(s): BSD-3-Clause, AGPL-1.0, Apache-2.0, LGPL-2.0, LGPL-3.0, GPL-2.0, CC-BY-SA-3.0, LGPL-2.1, GPL-3.0, MPL-2.0-no-copyleft-exception, IPL-1.0
  1. <?xml version='1.0'?>
  2. <!-- :folding=explicit: -->
  3. <!-- You should use this XSL stylesheet to create plugin documentation.
  4. If you want all output in a single HTML file, specify the path to
  5. your DocBook-XSL "html/docbook.xsl" file in the <xsl:import>
  6. statement below. If you want each chapter to have its own file,
  7. specify the path to your "html/chunk.xsl".
  8. This stylesheet assumes the user's guide XML source is in a
  9. subdirectory of the plugin's main dir (e.g., "docs/users-guide.xml").
  10. -->
  11. <xsl:stylesheet
  12. xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
  13. version="1.0"
  14. xmlns="http://www.w3.org/TR/xhtml1/transitional"
  15. xmlns:date="http://exslt.org/dates-and-times"
  16. extension-element-prefixes="date"
  17. exclude-result-prefixes="#default">
  18. <xsl:import href="file:///@docs.style.sheet@" />
  19. <!-- chunk by chapters instead of sections by setting chunk.section.depth to 0
  20. instead of the default 1 -->
  21. <xsl:param name="chunk.section.depth" select="1"/>
  22. <!-- Swing HTML control doesn't support &ldquo; and &rdquo; -->
  23. <xsl:template match="quote">&quot;<xsl:apply-templates/>&quot;</xsl:template>
  24. <xsl:template match="guibutton">
  25. <xsl:call-template name="inline.boldseq"/>
  26. </xsl:template>
  27. <xsl:template match="guiicon">
  28. <xsl:call-template name="inline.boldseq"/>
  29. </xsl:template>
  30. <xsl:template match="guilabel">
  31. <xsl:call-template name="inline.boldseq"/>
  32. </xsl:template>
  33. <xsl:template match="guimenu">
  34. <xsl:call-template name="inline.boldseq"/>
  35. </xsl:template>
  36. <xsl:template match="guimenuitem">
  37. <xsl:call-template name="inline.boldseq"/>
  38. </xsl:template>
  39. <xsl:template match="guisubmenu">
  40. <xsl:call-template name="inline.boldseq"/>
  41. </xsl:template>
  42. <xsl:template match="image">
  43. <p>
  44. <center>
  45. <img src="{src}" />
  46. </center>
  47. </p>
  48. </xsl:template>
  49. <xsl:template match="br">
  50. <br />
  51. </xsl:template>
  52. <xsl:param name="toc.list.type">ul</xsl:param>
  53. <xsl:param name="use.id.as.filename">1</xsl:param>
  54. <xsl:param name="shade.verbatim">1</xsl:param>
  55. <xsl:param name="funcsynopsis.style">ansi</xsl:param>
  56. <xsl:template match="void">
  57. <xsl:apply-templates/>
  58. </xsl:template>
  59. <xsl:param name="chunk.first.sections">1</xsl:param>
  60. <xsl:template match="*" mode="object.title.markup.textonly">
  61. <xsl:variable name="title">
  62. <xsl:apply-templates select="." mode="title.markup"/>
  63. </xsl:variable>
  64. <!-- used to get the html title of the page -->
  65. <xsl:value-of select="$title"/>
  66. </xsl:template>
  67. <!-- {{{ TOC generation -->
  68. <xsl:template match="/">
  69. <xsl:call-template name="toc"/>
  70. </xsl:template>
  71. <xsl:template name="toc">
  72. <xsl:apply-templates/>
  73. <xsl:call-template name="write.chunk">
  74. <xsl:with-param name="filename" select="'toc.xml'"/>
  75. <xsl:with-param name="method" select="'xml'"/>
  76. <xsl:with-param name="indent" select="'yes'"/>
  77. <xsl:with-param name="content">
  78. <xsl:call-template name="toc.content"/>
  79. </xsl:with-param>
  80. </xsl:call-template>
  81. </xsl:template>
  82. <xsl:template name="toc.content">
  83. <TOC>
  84. <xsl:apply-templates select="." mode="my.toc"/>
  85. </TOC>
  86. </xsl:template>
  87. <xsl:template match="set" mode="my.toc">
  88. <ENTRY>
  89. <xsl:attribute name="HREF">
  90. <xsl:call-template name="href.target">
  91. <xsl:with-param name="object" select="."/>
  92. </xsl:call-template>
  93. </xsl:attribute>
  94. <TITLE>
  95. <xsl:apply-templates mode="title.markup" select="."/>
  96. </TITLE>
  97. <xsl:apply-templates select="book" mode="my.toc"/>
  98. </ENTRY>
  99. </xsl:template>
  100. <xsl:template match="book" mode="my.toc">
  101. <ENTRY>
  102. <xsl:attribute name="HREF">
  103. <xsl:call-template name="href.target">
  104. <xsl:with-param name="object" select="."/>
  105. </xsl:call-template>
  106. </xsl:attribute>
  107. <TITLE>
  108. <xsl:apply-templates mode="title.markup" select="."/>
  109. </TITLE>
  110. <xsl:apply-templates select="part|reference|preface|chapter|appendix|article|colophon" mode="my.toc"/>
  111. </ENTRY>
  112. </xsl:template>
  113. <xsl:template match="part|reference|preface|chapter|appendix|article" mode="my.toc">
  114. <ENTRY>
  115. <xsl:attribute name="HREF">
  116. <xsl:call-template name="href.target">
  117. <xsl:with-param name="object" select="."/>
  118. </xsl:call-template>
  119. </xsl:attribute>
  120. <TITLE>
  121. <xsl:apply-templates mode="title.markup" select="."/>
  122. </TITLE>
  123. <xsl:apply-templates select="preface|chapter|appendix|refentry|section|sect1" mode="my.toc"/>
  124. </ENTRY>
  125. </xsl:template>
  126. <xsl:template match="section" mode="my.toc">
  127. <ENTRY>
  128. <xsl:attribute name="HREF">
  129. <xsl:call-template name="href.target">
  130. <xsl:with-param name="object" select="."/>
  131. </xsl:call-template>
  132. </xsl:attribute>
  133. <TITLE>
  134. <xsl:apply-templates mode="title.markup" select="."/>
  135. </TITLE>
  136. <xsl:apply-templates select="section" mode="my.toc"/>
  137. </ENTRY>
  138. </xsl:template>
  139. <xsl:template match="sect1" mode="my.toc">
  140. <ENTRY>
  141. <xsl:attribute name="HREF">
  142. <xsl:call-template name="href.target">
  143. <xsl:with-param name="object" select="."/>
  144. </xsl:call-template>
  145. </xsl:attribute>
  146. <TITLE>
  147. <xsl:apply-templates mode="title.markup" select="."/>
  148. </TITLE>
  149. <xsl:apply-templates select="sect2" mode="my.toc"/>
  150. </ENTRY>
  151. </xsl:template>
  152. <xsl:template match="sect2" mode="my.toc">
  153. <ENTRY>
  154. <xsl:attribute name="HREF">
  155. <xsl:call-template name="href.target">
  156. <xsl:with-param name="object" select="."/>
  157. </xsl:call-template>
  158. </xsl:attribute>
  159. <TITLE>
  160. <xsl:apply-templates mode="title.markup" select="."/>
  161. </TITLE>
  162. <xsl:apply-templates select="sect3" mode="my.toc"/>
  163. </ENTRY>
  164. </xsl:template>
  165. <xsl:template match="sect3" mode="my.toc">
  166. <ENTRY>
  167. <xsl:attribute name="HREF">
  168. <xsl:call-template name="href.target">
  169. <xsl:with-param name="object" select="."/>
  170. </xsl:call-template>
  171. </xsl:attribute>
  172. <TITLE>
  173. <xsl:apply-templates mode="title.markup" select="."/>
  174. </TITLE>
  175. <xsl:apply-templates select="sect4" mode="my.toc"/>
  176. </ENTRY>
  177. </xsl:template>
  178. <xsl:template match="sect4" mode="my.toc">
  179. <ENTRY>
  180. <xsl:attribute name="HREF">
  181. <xsl:call-template name="href.target">
  182. <xsl:with-param name="object" select="."/>
  183. </xsl:call-template>
  184. </xsl:attribute>
  185. <TITLE>
  186. <xsl:apply-templates mode="title.markup" select="."/>
  187. </TITLE>
  188. <xsl:apply-templates select="sect5" mode="my.toc"/>
  189. </ENTRY>
  190. </xsl:template>
  191. <xsl:template match="sect5|colophon" mode="my.toc">
  192. <ENTRY>
  193. <xsl:attribute name="HREF">
  194. <xsl:call-template name="href.target">
  195. <xsl:with-param name="object" select="."/>
  196. </xsl:call-template>
  197. </xsl:attribute>
  198. <TITLE>
  199. <xsl:apply-templates mode="title.markup" select="."/>
  200. </TITLE>
  201. </ENTRY>
  202. </xsl:template>
  203. <!-- }}} -->
  204. <!-- {{{ Dale's gorgeous HTMl template -->
  205. <!-- title banner, from docbook/html/titlepage.templates.xsl -->
  206. <xsl:template name="article.titlepage.recto">
  207. <xsl:call-template name="article-or-book.titlepage.recto"/>
  208. </xsl:template>
  209. <xsl:template name="book.titlepage.recto">
  210. <xsl:call-template name="article-or-book.titlepage.recto"/>
  211. </xsl:template>
  212. <xsl:template name="article-or-book.titlepage.recto">
  213. <table summary="Header" cellspacing="0" border="0" width="100%" cols="2">
  214. <tr width="100%" bgcolor="#CCCCFF">
  215. <!-- left cell : title, copyright -->
  216. <td valign="TOP">
  217. <xsl:choose>
  218. <xsl:when test="bookinfo/title">
  219. <xsl:apply-templates mode="article.titlepage.recto.auto.mode" select="bookinfo/title"/>
  220. </xsl:when>
  221. <xsl:when test="articleinfo/title">
  222. <xsl:apply-templates mode="article.titlepage.recto.auto.mode" select="articleinfo/title"/>
  223. </xsl:when>
  224. <xsl:when test="artheader/title">
  225. <xsl:apply-templates mode="article.titlepage.recto.auto.mode" select="artheader/title"/>
  226. </xsl:when>
  227. <xsl:when test="info/title">
  228. <xsl:apply-templates mode="article.titlepage.recto.auto.mode" select="info/title"/>
  229. </xsl:when>
  230. <xsl:when test="title">
  231. <xsl:apply-templates mode="article.titlepage.recto.auto.mode" select="title"/>
  232. </xsl:when>
  233. </xsl:choose>
  234. <!-- maybe the copyright notice should go on another line... -->
  235. <xsl:apply-templates mode="article.titlepage.recto.auto.mode" select="articleinfo/copyright"/>
  236. <xsl:apply-templates mode="article.titlepage.recto.auto.mode" select="bookinfo/copyright"/>
  237. <xsl:apply-templates mode="article.titlepage.recto.auto.mode" select="artheader/copyright"/>
  238. <xsl:apply-templates mode="article.titlepage.recto.auto.mode" select="info/copyright"/>
  239. </td>
  240. <!-- right cell : version, generation date and authors -->
  241. <td valign="TOP" align="RIGHT">
  242. <font size="-1">
  243. <p>
  244. <strong>
  245. <!-- release -->
  246. <xsl:apply-templates mode="article.titlepage.recto.auto.mode" select="articleinfo/releaseinfo"/>
  247. <xsl:apply-templates mode="article.titlepage.recto.auto.mode" select="bookinfo/releaseinfo"/>
  248. <xsl:apply-templates mode="article.titlepage.recto.auto.mode" select="artheader/releaseinfo"/>
  249. <xsl:apply-templates mode="article.titlepage.recto.auto.mode" select="info/releaseinfo"/>
  250. <!-- compute release date automatically -->
  251. <xsl:text> (</xsl:text>
  252. <xsl:value-of select="concat(date:month-name(),' ',date:day-in-month(), ' ', date:year())"/>
  253. <xsl:text>)</xsl:text>
  254. </strong>
  255. </p>
  256. <!-- hackish list of authors -->
  257. <xsl:for-each select="//author">
  258. <p>
  259. <xsl:apply-templates select="."/>
  260. </p>
  261. </xsl:for-each>
  262. </font>
  263. </td>
  264. </tr>
  265. </table>
  266. <xsl:apply-templates mode="article.titlepage.recto.auto.mode" select="articleinfo/legalnotice"/>
  267. <xsl:apply-templates mode="article.titlepage.recto.auto.mode" select="artheader/legalnotice"/>
  268. <xsl:apply-templates mode="article.titlepage.recto.auto.mode" select="info/legalnotice"/>
  269. <xsl:apply-templates mode="article.titlepage.recto.auto.mode" select="articleinfo/revhistory"/>
  270. <xsl:apply-templates mode="article.titlepage.recto.auto.mode" select="artheader/revhistory"/>
  271. <xsl:apply-templates mode="article.titlepage.recto.auto.mode" select="info/revhistory"/>
  272. <xsl:apply-templates mode="article.titlepage.recto.auto.mode" select="articleinfo/abstract"/>
  273. <xsl:apply-templates mode="article.titlepage.recto.auto.mode" select="artheader/abstract"/>
  274. <xsl:apply-templates mode="article.titlepage.recto.auto.mode" select="info/abstract"/>
  275. </xsl:template>
  276. <xsl:template match="title" mode="article.titlepage.recto.auto.mode">
  277. <strong>
  278. <font size="+2">
  279. <xsl:value-of select="."/>
  280. </font>
  281. </strong>
  282. </xsl:template>
  283. <xsl:template match="releaseinfo" mode="article.titlepage.recto.auto.mode">
  284. <xsl:apply-templates/>
  285. </xsl:template>
  286. <!-- whole line white on blue banner for the legal notice
  287. overrides docbook-xsl/html/titlepage.xsl
  288. disabled because I prefer a standard legal notice title
  289. -->
  290. <!--<xsl:template match="legalnotice/title" mode="titlepage.mode">
  291. <xsl:call-template name="section.heading">
  292. <xsl:with-param name="section" select="parent::*"/>
  293. <xsl:with-param name="allow-anchors" select="0"/>
  294. <xsl:with-param name="title" select="string(.)"/>
  295. </xsl:call-template>
  296. </xsl:template>-->
  297. <!-- whole line white on blue banner for each (sub)section
  298. overrides docbook-xsl/html/sections.xsl
  299. -->
  300. <xsl:template name="section.heading">
  301. <xsl:param name="section" select="."/>
  302. <xsl:param name="level" select="1"/>
  303. <xsl:param name="allow-anchors" select="1"/>
  304. <xsl:param name="title"/>
  305. <xsl:param name="class" select="'title'"/>
  306. <xsl:variable name="id">
  307. <xsl:choose>
  308. <!-- Make sure the subtitle doesn't get the same id as the title -->
  309. <xsl:when test="self::subtitle">
  310. <xsl:call-template name="object.id">
  311. <xsl:with-param name="object" select="."/>
  312. </xsl:call-template>
  313. </xsl:when>
  314. <!-- if title is in an *info wrapper, get the grandparent -->
  315. <xsl:when test="contains(local-name(..), 'info')">
  316. <xsl:call-template name="object.id">
  317. <xsl:with-param name="object" select="../.."/>
  318. </xsl:call-template>
  319. </xsl:when>
  320. <xsl:otherwise>
  321. <xsl:call-template name="object.id">
  322. <xsl:with-param name="object" select=".."/>
  323. </xsl:call-template>
  324. </xsl:otherwise>
  325. </xsl:choose>
  326. </xsl:variable>
  327. <table summary="{.}" border="0" cellspacing="0" cellpadding="0" width="100%">
  328. <tr align="CENTER" width="100%">
  329. <td bgcolor="#7FB2FF" width="100%">
  330. <strong>
  331. <font color="#FFFFFF" size="+1">
  332. <span>
  333. <xsl:if test="$allow-anchors != 0 and $generate.id.attributes = 0">
  334. <xsl:call-template name="anchor">
  335. <xsl:with-param name="node" select="$section"/>
  336. <xsl:with-param name="conditional" select="0"/>
  337. </xsl:call-template>
  338. </xsl:if>
  339. <xsl:if test="$generate.id.attributes != 0 and not(local-name(.) = 'appendix')">
  340. <xsl:attribute name="id">
  341. <xsl:value-of select="$id"/>
  342. </xsl:attribute>
  343. </xsl:if>
  344. <xsl:copy-of select="$title"/>
  345. </span>
  346. </font>
  347. </strong>
  348. </td>
  349. </tr>
  350. </table>
  351. </xsl:template>
  352. <!-- for chapter titles,
  353. overrides docbook-xsl/html/component.xsl
  354. -->
  355. <xsl:template name="component.title">
  356. <xsl:param name="node" select="."/>
  357. <xsl:call-template name="section.heading">
  358. <xsl:with-param name="title">
  359. <xsl:apply-templates select="$node" mode="object.title.markup">
  360. <xsl:with-param name="allow-anchors" select="1"/>
  361. </xsl:apply-templates>
  362. </xsl:with-param>
  363. <xsl:with-param name="section" select="$node"/>
  364. </xsl:call-template>
  365. </xsl:template>
  366. <!-- }}} -->
  367. </xsl:stylesheet>