refentry.xsl 9.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309
  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$
  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. <xsl:template match="reference">
  14. <xsl:call-template name="id.warning"/>
  15. <div>
  16. <xsl:apply-templates select="." mode="class.attribute"/>
  17. <xsl:call-template name="dir">
  18. <xsl:with-param name="inherit" select="1"/>
  19. </xsl:call-template>
  20. <xsl:call-template name="language.attribute"/>
  21. <xsl:if test="$generate.id.attributes != 0">
  22. <xsl:attribute name="id">
  23. <xsl:call-template name="object.id"/>
  24. </xsl:attribute>
  25. </xsl:if>
  26. <xsl:call-template name="reference.titlepage"/>
  27. <xsl:variable name="toc.params">
  28. <xsl:call-template name="find.path.params">
  29. <xsl:with-param name="table" select="normalize-space($generate.toc)"/>
  30. </xsl:call-template>
  31. </xsl:variable>
  32. <xsl:if test="not(partintro) and contains($toc.params, 'toc')">
  33. <xsl:call-template name="division.toc"/>
  34. </xsl:if>
  35. <xsl:apply-templates/>
  36. </div>
  37. </xsl:template>
  38. <xsl:template match="reference" mode="division.number">
  39. <xsl:number from="book" count="reference" format="I."/>
  40. </xsl:template>
  41. <xsl:template match="reference/docinfo"/>
  42. <xsl:template match="reference/referenceinfo"/>
  43. <xsl:template match="reference/title"/>
  44. <xsl:template match="reference/subtitle"/>
  45. <xsl:template match="reference/titleabbrev"/>
  46. <!-- ==================================================================== -->
  47. <xsl:template name="refentry.title">
  48. <xsl:param name="node" select="."/>
  49. <xsl:variable name="refmeta" select="$node//refmeta"/>
  50. <xsl:variable name="refentrytitle" select="$refmeta//refentrytitle"/>
  51. <xsl:variable name="refnamediv" select="$node//refnamediv"/>
  52. <xsl:variable name="refname" select="$refnamediv//refname"/>
  53. <xsl:variable name="refdesc" select="$refnamediv//refdescriptor"/>
  54. <xsl:variable name="title">
  55. <xsl:choose>
  56. <xsl:when test="$refentrytitle">
  57. <xsl:apply-templates select="$refentrytitle[1]" mode="title"/>
  58. </xsl:when>
  59. <xsl:when test="$refdesc">
  60. <xsl:apply-templates select="$refdesc[1]" mode="title"/>
  61. </xsl:when>
  62. <xsl:when test="$refname">
  63. <xsl:apply-templates select="$refname[1]" mode="title"/>
  64. </xsl:when>
  65. <xsl:otherwise/>
  66. </xsl:choose>
  67. </xsl:variable>
  68. <h1 class="title">
  69. <xsl:copy-of select="$title"/>
  70. </h1>
  71. </xsl:template>
  72. <xsl:template match="refentry">
  73. <xsl:call-template name="id.warning"/>
  74. <div>
  75. <xsl:apply-templates select="." mode="class.attribute"/>
  76. <xsl:call-template name="dir">
  77. <xsl:with-param name="inherit" select="1"/>
  78. </xsl:call-template>
  79. <xsl:call-template name="language.attribute"/>
  80. <xsl:if test="$refentry.separator != 0 and preceding-sibling::refentry">
  81. <div class="refentry.separator">
  82. <hr/>
  83. </div>
  84. </xsl:if>
  85. <xsl:call-template name="anchor">
  86. <xsl:with-param name="conditional" select="0"/>
  87. </xsl:call-template>
  88. <xsl:call-template name="refentry.titlepage"/>
  89. <xsl:apply-templates/>
  90. <xsl:call-template name="process.footnotes"/>
  91. </div>
  92. </xsl:template>
  93. <xsl:template match="refentry/docinfo|refentry/refentryinfo"/>
  94. <xsl:template match="refentry/info"/>
  95. <xsl:template match="refentrytitle|refname|refdescriptor" mode="title">
  96. <xsl:apply-templates/>
  97. </xsl:template>
  98. <xsl:template match="refmeta">
  99. </xsl:template>
  100. <xsl:template match="manvolnum">
  101. <xsl:if test="$refentry.xref.manvolnum != 0">
  102. <xsl:text>(</xsl:text>
  103. <xsl:apply-templates/>
  104. <xsl:text>)</xsl:text>
  105. </xsl:if>
  106. </xsl:template>
  107. <xsl:template match="refmiscinfo">
  108. </xsl:template>
  109. <xsl:template match="refentrytitle">
  110. <xsl:call-template name="inline.charseq"/>
  111. </xsl:template>
  112. <xsl:template match="refnamediv">
  113. <div>
  114. <xsl:apply-templates select="." mode="class.attribute"/>
  115. <xsl:call-template name="dir">
  116. <xsl:with-param name="inherit" select="1"/>
  117. </xsl:call-template>
  118. <xsl:call-template name="anchor"/>
  119. <xsl:choose>
  120. <xsl:when test="preceding-sibling::refnamediv">
  121. <!-- no title on secondary refnamedivs! -->
  122. </xsl:when>
  123. <xsl:when test="$refentry.generate.name != 0">
  124. <h2>
  125. <xsl:call-template name="gentext">
  126. <xsl:with-param name="key" select="'RefName'"/>
  127. </xsl:call-template>
  128. </h2>
  129. </xsl:when>
  130. <xsl:when test="$refentry.generate.title != 0">
  131. <h2>
  132. <xsl:choose>
  133. <xsl:when test="../refmeta/refentrytitle">
  134. <xsl:apply-templates select="../refmeta/refentrytitle"/>
  135. </xsl:when>
  136. <xsl:otherwise>
  137. <xsl:apply-templates select="refname[1]"/>
  138. </xsl:otherwise>
  139. </xsl:choose>
  140. </h2>
  141. </xsl:when>
  142. </xsl:choose>
  143. <p>
  144. <xsl:apply-templates/>
  145. </p>
  146. </div>
  147. </xsl:template>
  148. <xsl:template match="refname">
  149. <xsl:if test="not(preceding-sibling::refdescriptor)">
  150. <xsl:apply-templates/>
  151. <xsl:if test="following-sibling::refname">
  152. <xsl:text>, </xsl:text>
  153. </xsl:if>
  154. </xsl:if>
  155. </xsl:template>
  156. <xsl:template match="refpurpose">
  157. <xsl:if test="node()">
  158. <xsl:text> </xsl:text>
  159. <xsl:call-template name="dingbat">
  160. <xsl:with-param name="dingbat">em-dash</xsl:with-param>
  161. </xsl:call-template>
  162. <xsl:text> </xsl:text>
  163. <xsl:apply-templates/>
  164. </xsl:if>
  165. </xsl:template>
  166. <xsl:template match="refdescriptor">
  167. <xsl:apply-templates/>
  168. </xsl:template>
  169. <xsl:template match="refclass">
  170. <xsl:if test="$refclass.suppress = 0">
  171. <p>
  172. <b>
  173. <xsl:if test="@role">
  174. <xsl:value-of select="@role"/>
  175. <xsl:text>: </xsl:text>
  176. </xsl:if>
  177. <xsl:apply-templates/>
  178. </b>
  179. </p>
  180. </xsl:if>
  181. </xsl:template>
  182. <xsl:template match="refsynopsisdiv">
  183. <div>
  184. <xsl:apply-templates select="." mode="class.attribute"/>
  185. <xsl:call-template name="dir">
  186. <xsl:with-param name="inherit" select="1"/>
  187. </xsl:call-template>
  188. <xsl:call-template name="anchor"/>
  189. <h2>
  190. <xsl:choose>
  191. <xsl:when test="refsynopsisdiv/title|title">
  192. <xsl:apply-templates select="(refsynopsisdiv/title|title)[1]" mode="titlepage.mode"/>
  193. </xsl:when>
  194. <xsl:otherwise>
  195. <xsl:call-template name="gentext">
  196. <xsl:with-param name="key" select="'RefSynopsisDiv'"/>
  197. </xsl:call-template>
  198. </xsl:otherwise>
  199. </xsl:choose>
  200. </h2>
  201. <xsl:apply-templates/>
  202. </div>
  203. </xsl:template>
  204. <xsl:template match="refsynopsisdivinfo"/>
  205. <xsl:template match="refsynopsisdiv/title">
  206. </xsl:template>
  207. <xsl:template match="refsynopsisdiv/title" mode="titlepage.mode">
  208. <xsl:apply-templates/>
  209. </xsl:template>
  210. <xsl:template match="refsection|refsect1|refsect2|refsect3">
  211. <div>
  212. <xsl:apply-templates select="." mode="class.attribute"/>
  213. <xsl:call-template name="dir">
  214. <xsl:with-param name="inherit" select="1"/>
  215. </xsl:call-template>
  216. <xsl:call-template name="language.attribute"/>
  217. <xsl:call-template name="anchor">
  218. <xsl:with-param name="conditional" select="0"/>
  219. </xsl:call-template>
  220. <!-- pick up info title -->
  221. <xsl:apply-templates select="(title|info/title)[1]"/>
  222. <xsl:apply-templates select="node()[not(self::title) and not(self::info)]"/>
  223. </div>
  224. </xsl:template>
  225. <xsl:template match="refsection/title|refsection/info/title">
  226. <!-- the ID is output in the block.object call for refsect1 -->
  227. <xsl:variable name="level" select="count(ancestor-or-self::refsection)"/>
  228. <xsl:variable name="refsynopsisdiv">
  229. <xsl:text>0</xsl:text>
  230. <xsl:if test="ancestor::refsynopsisdiv">1</xsl:if>
  231. </xsl:variable>
  232. <xsl:variable name="hlevel">
  233. <xsl:choose>
  234. <xsl:when test="$level+$refsynopsisdiv &gt; 5">6</xsl:when>
  235. <xsl:otherwise>
  236. <xsl:value-of select="$level+1+$refsynopsisdiv"/>
  237. </xsl:otherwise>
  238. </xsl:choose>
  239. </xsl:variable>
  240. <xsl:element name="h{$hlevel}" namespace="http://www.w3.org/1999/xhtml">
  241. <xsl:apply-templates/>
  242. </xsl:element>
  243. </xsl:template>
  244. <xsl:template match="refsect1/title|refsect1/info/title">
  245. <!-- the ID is output in the block.object call for refsect1 -->
  246. <h2>
  247. <xsl:apply-templates/>
  248. </h2>
  249. </xsl:template>
  250. <xsl:template match="refsect2/title|refsect2/info/title">
  251. <!-- the ID is output in the block.object call for refsect2 -->
  252. <h3>
  253. <xsl:apply-templates/>
  254. </h3>
  255. </xsl:template>
  256. <xsl:template match="refsect3/title|refsect3/info/title">
  257. <!-- the ID is output in the block.object call for refsect3 -->
  258. <h4>
  259. <xsl:apply-templates/>
  260. </h4>
  261. </xsl:template>
  262. <xsl:template match="refsectioninfo|refsection/info"/>
  263. <xsl:template match="refsect1info|refsect1/info"/>
  264. <xsl:template match="refsect2info|refsect2/info"/>
  265. <xsl:template match="refsect3info|refsect3/info"/>
  266. <!-- ==================================================================== -->
  267. </xsl:stylesheet>