doc2html.xsl 8.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369
  1. <?xml version="1.0" encoding="utf-8"?>
  2. <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
  3. <!-- ***************************************************************
  4. VampyreDoc Tool
  5. Documentation XSL stylesheet which transforms VampyreDoc to
  6. XHTML page (in Borland Dev Studio help style).
  7. Note: these <xsl:text> </xsl:text> are at the ends of inline
  8. elements are here because of MS IE. It does not put spaces
  9. between e.g. <icode>umajo</icode> <b>boldly umajo</b>
  10. even there is space or linebreak in xml file.
  11. **************************************************************** -->
  12. <xsl:output method="xml" encoding="utf-8" indent="no"
  13. doctype-public="-//W3C//DTD XHTML 1.0 Strict//EN"
  14. doctype-system="http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"/>
  15. <xsl:template match="doc">
  16. <html>
  17. <!-- <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
  18. this adds ugly empty xmlns="" attribute to many elements
  19. when transforming with Saxon -->
  20. <head>
  21. <meta http-equiv="content-type" content="text/html; charset=utf-8" />
  22. <meta name="generator" content="VampyreDoc" />
  23. <link href="../common/doc.css" type="text/css" rel="stylesheet" />
  24. <link href="../../common/doc.css" type="text/css" rel="stylesheet" />
  25. <link href="../../../common/doc.css" type="text/css" rel="stylesheet" />
  26. <link href="doc.css" type="text/css" rel="stylesheet" />
  27. <xsl:call-template name="doctitle" />
  28. </head>
  29. <body>
  30. <xsl:apply-templates select="chapter" />
  31. <br />
  32. <xsl:call-template name="pagefooter" />
  33. <br />
  34. </body>
  35. </html>
  36. </xsl:template>
  37. <!-- ***********************************
  38. Specials
  39. *********************************** -->
  40. <xsl:template match="chapter">
  41. <xsl:apply-templates />
  42. </xsl:template>
  43. <xsl:template match="section">
  44. <xsl:apply-templates />
  45. </xsl:template>
  46. <!-- ***********************************
  47. Headers & Captions
  48. *********************************** -->
  49. <xsl:template name="doctitle">
  50. <title>
  51. <xsl:choose>
  52. <xsl:when test="title!=''">
  53. <xsl:value-of select="title"/>
  54. </xsl:when>
  55. <xsl:otherwise>
  56. Documentation
  57. </xsl:otherwise>
  58. </xsl:choose>
  59. </title>
  60. </xsl:template>
  61. <xsl:template match="title">
  62. <span class="title">
  63. <xsl:value-of select="."/>
  64. </span>
  65. </xsl:template>
  66. <xsl:template match="lcap|largecap">
  67. <span class="subtopic1">
  68. <xsl:apply-templates/>
  69. </span>
  70. </xsl:template>
  71. <xsl:template match="mcap|mediumcap">
  72. <span class="subtopic2">
  73. <xsl:apply-templates/>
  74. </span>
  75. </xsl:template>
  76. <xsl:template match="scap|smallcap">
  77. <span class="caption">
  78. <xsl:apply-templates/>
  79. </span>
  80. </xsl:template>
  81. <!-- ***********************************
  82. Lists
  83. *********************************** -->
  84. <xsl:template match="list">
  85. <ul class="list">
  86. <xsl:apply-templates select="li" />
  87. </ul>
  88. </xsl:template>
  89. <xsl:template match="linklist|lslist">
  90. <div class="linklist">
  91. <div class="s">
  92. <xsl:value-of select="title"/>
  93. </div>
  94. <xsl:apply-templates select="listedlink|lslink" mode="inlist"/>
  95. </div>
  96. </xsl:template>
  97. <xsl:template match="bulletlist|blist">
  98. <ul class="bullet">
  99. <xsl:apply-templates select="li" />
  100. </ul>
  101. </xsl:template>
  102. <xsl:template match="orderedlist|olist">
  103. <ol class="orderedlist">
  104. <xsl:apply-templates select="li"/>
  105. </ol>
  106. </xsl:template>
  107. <xsl:template match="li">
  108. <li class="li">
  109. <xsl:apply-templates />
  110. </li>
  111. </xsl:template>
  112. <!-- ***********************************
  113. Text Formatting
  114. *********************************** -->
  115. <xsl:template match="b|bold">
  116. <b>
  117. <xsl:apply-templates />
  118. </b>
  119. </xsl:template>
  120. <xsl:template match="u|under">
  121. <u>
  122. <xsl:apply-templates />
  123. </u>
  124. </xsl:template>
  125. <xsl:template match="i|italic">
  126. <i>
  127. <xsl:apply-templates />
  128. </i>
  129. </xsl:template>
  130. <xsl:template match="center">
  131. <center>
  132. <xsl:apply-templates />
  133. </center>
  134. </xsl:template>
  135. <xsl:template match="linebreak|br">
  136. <br />
  137. </xsl:template>
  138. <xsl:template match="par|para">
  139. <p class="para">
  140. <xsl:apply-templates />
  141. </p>
  142. </xsl:template>
  143. <xsl:template match="code">
  144. <pre class="syntax">
  145. <xsl:apply-templates />
  146. </pre>
  147. </xsl:template>
  148. <xsl:template match="icode">
  149. <code class="codeinline">
  150. <xsl:apply-templates />
  151. </code>
  152. </xsl:template>
  153. <xsl:template match="keyword">
  154. <code class="keyword">
  155. <xsl:apply-templates />
  156. </code>
  157. </xsl:template>
  158. <xsl:template match="tip">
  159. <div class="tip">
  160. Tip:
  161. <span class="ntwpara">
  162. <xsl:apply-templates />
  163. </span>
  164. </div>
  165. </xsl:template>
  166. <xsl:template match="warning|warn">
  167. <div class="warning">
  168. Warning:
  169. <span class="ntwpara">
  170. <xsl:apply-templates />
  171. </span>
  172. </div>
  173. </xsl:template>
  174. <xsl:template match="note">
  175. <div class="note">
  176. Note:
  177. <span class="ntwpara">
  178. <xsl:apply-templates />
  179. </span>
  180. </div>
  181. </xsl:template>
  182. <xsl:template match="menuitem|mitem">
  183. <span class="menuitem">
  184. <xsl:apply-templates />
  185. </span>
  186. </xsl:template>
  187. <!-- ***********************************
  188. Links
  189. *********************************** -->
  190. <xsl:template match="link">
  191. <span class="link">
  192. <a>
  193. <xsl:attribute name="href">
  194. <xsl:if test="@url!=''">
  195. <xsl:value-of select="@url"/>
  196. </xsl:if>
  197. </xsl:attribute>
  198. <xsl:apply-templates />
  199. </a>
  200. </span>
  201. </xsl:template>
  202. <xsl:template match="listedlink|lslink">
  203. <span class="listedlink">
  204. <a>
  205. <xsl:attribute name="href">
  206. <xsl:if test="@url!=''">
  207. <xsl:value-of select="@url"/>
  208. </xsl:if>
  209. </xsl:attribute>
  210. <xsl:apply-templates />
  211. </a>
  212. </span>
  213. </xsl:template>
  214. <xsl:template match="listedlink|lslink" mode="inlist">
  215. <div class="linklistitem">
  216. <xsl:apply-templates select="."/>
  217. </div>
  218. </xsl:template>
  219. <xsl:template match="anchor">
  220. <a>
  221. <xsl:attribute name="id">
  222. <xsl:value-of select="@name"/>
  223. </xsl:attribute>
  224. <xsl:apply-templates />
  225. </a>
  226. </xsl:template>
  227. <xsl:template match="ref">
  228. <span class="codeinline">
  229. <span class="link">
  230. <a>
  231. <xsl:attribute name="href">
  232. <xsl:value-of select="@url"/>
  233. </xsl:attribute>
  234. <xsl:apply-templates />
  235. </a>
  236. </span>
  237. </span>
  238. </xsl:template>
  239. <!-- ***********************************
  240. Images
  241. *********************************** -->
  242. <xsl:template match="image|img">
  243. <img class="imageblock">
  244. <xsl:attribute name="src">
  245. <xsl:value-of select="@url"/>
  246. </xsl:attribute>
  247. <xsl:attribute name="alt">
  248. <xsl:value-of select="@desc"/>
  249. </xsl:attribute>
  250. </img>
  251. </xsl:template>
  252. <xsl:template match="inlineimage|inimg">
  253. <img class="imageinline">
  254. <xsl:attribute name="src">
  255. <xsl:value-of select="@url"/>
  256. </xsl:attribute>
  257. <xsl:attribute name="alt">
  258. <xsl:value-of select="@desc"/>
  259. </xsl:attribute>
  260. </img>
  261. </xsl:template>
  262. <!-- ***********************************
  263. Tables
  264. *********************************** -->
  265. <xsl:template match="table">
  266. <xsl:if test="title!=''">
  267. <span class="tabletitle">
  268. <xsl:value-of select="title"/>
  269. </span>
  270. </xsl:if>
  271. <table class="table">
  272. <xsl:apply-templates select="row|tr"/>
  273. </table>
  274. </xsl:template>
  275. <xsl:template match="row|tr">
  276. <tr class="tr">
  277. <xsl:apply-templates select="cell|th|header|td"/>
  278. </tr>
  279. </xsl:template>
  280. <xsl:template match="cell|td">
  281. <td class="td">
  282. <xsl:if test="@colspan!=''">
  283. <xsl:attribute name="colspan">
  284. <xsl:value-of select="@colspan"/>
  285. </xsl:attribute>
  286. </xsl:if>
  287. <xsl:if test="@rowspan!=''">
  288. <xsl:attribute name="rowspan">
  289. <xsl:value-of select="@rowspan"/>
  290. </xsl:attribute>
  291. </xsl:if>
  292. <span class="tablepara">
  293. <xsl:apply-templates />
  294. </span>
  295. </td>
  296. </xsl:template>
  297. <xsl:template match="header|th">
  298. <th class="th">
  299. <xsl:apply-templates />
  300. </th>
  301. </xsl:template>
  302. <!-- ***********************************
  303. Page Footer
  304. *********************************** -->
  305. <xsl:template name="pagefooter">
  306. <br /><br />
  307. <div class="footer">
  308. <xsl:text>
  309. Vampyre Imaging Library (Documentation for version 0.26.4)
  310. </xsl:text>
  311. <br />
  312. <a href="http://imaginglib.sourceforge.net" target="_blank">
  313. http://imaginglib.sourceforge.net</a>
  314. <br />
  315. </div>
  316. </xsl:template>
  317. </xsl:stylesheet>