refentry.xsl 9.3 KB

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