pi.xsl 8.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252
  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. <xsl:template match="processing-instruction()">
  13. </xsl:template>
  14. <xsl:template match="processing-instruction('dbhtml')">
  15. <!-- nop -->
  16. </xsl:template>
  17. <!-- ==================================================================== -->
  18. <xsl:template name="dbhtml-attribute">
  19. <xsl:param name="pis" select="processing-instruction('dbhtml')"/>
  20. <xsl:param name="attribute">filename</xsl:param>
  21. <xsl:call-template name="pi-attribute">
  22. <xsl:with-param name="pis" select="$pis"/>
  23. <xsl:with-param name="attribute" select="$attribute"/>
  24. </xsl:call-template>
  25. </xsl:template>
  26. <xsl:template name="dbhtml-filename">
  27. <xsl:param name="pis" select="./processing-instruction('dbhtml')"/>
  28. <xsl:call-template name="dbhtml-attribute">
  29. <xsl:with-param name="pis" select="$pis"/>
  30. <xsl:with-param name="attribute">filename</xsl:with-param>
  31. </xsl:call-template>
  32. </xsl:template>
  33. <!--
  34. <xsl:template name="dbhtml-dir">
  35. <xsl:param name="pis" select="./processing-instruction('dbhtml')"/>
  36. <xsl:call-template name="dbhtml-attribute">
  37. <xsl:with-param name="pis" select="$pis"/>
  38. <xsl:with-param name="attribute">dir</xsl:with-param>
  39. </xsl:call-template>
  40. </xsl:template>
  41. -->
  42. <xsl:template name="dbhtml-dir">
  43. <xsl:param name="context" select="."/>
  44. <!-- directories are now inherited from previous levels -->
  45. <xsl:variable name="ppath">
  46. <xsl:if test="$context/parent::*">
  47. <xsl:call-template name="dbhtml-dir">
  48. <xsl:with-param name="context" select="$context/parent::*"/>
  49. </xsl:call-template>
  50. </xsl:if>
  51. </xsl:variable>
  52. <xsl:variable name="path">
  53. <xsl:call-template name="dbhtml-attribute">
  54. <xsl:with-param name="pis" select="$context/processing-instruction('dbhtml')"/>
  55. <xsl:with-param name="attribute">dir</xsl:with-param>
  56. </xsl:call-template>
  57. </xsl:variable>
  58. <xsl:choose>
  59. <xsl:when test="$path = ''">
  60. <xsl:if test="$ppath != ''">
  61. <xsl:value-of select="$ppath"/>
  62. </xsl:if>
  63. </xsl:when>
  64. <xsl:otherwise>
  65. <xsl:if test="$ppath != ''">
  66. <xsl:value-of select="$ppath"/>
  67. <xsl:if test="substring($ppath, string-length($ppath), 1) != '/'">
  68. <xsl:text>/</xsl:text>
  69. </xsl:if>
  70. </xsl:if>
  71. <xsl:value-of select="$path"/>
  72. <xsl:text>/</xsl:text>
  73. </xsl:otherwise>
  74. </xsl:choose>
  75. </xsl:template>
  76. <!-- ==================================================================== -->
  77. <xsl:template name="process.cmdsynopsis.list">
  78. <xsl:param name="cmdsynopses"/><!-- empty node list by default -->
  79. <xsl:param name="count" select="1"/>
  80. <xsl:choose>
  81. <xsl:when test="$count&gt;count($cmdsynopses)"/>
  82. <xsl:otherwise>
  83. <xsl:variable name="cmdsyn" select="$cmdsynopses[$count]"/>
  84. <dt>
  85. <a>
  86. <xsl:attribute name="href">
  87. <xsl:call-template name="object.id">
  88. <xsl:with-param name="object" select="$cmdsyn"/>
  89. </xsl:call-template>
  90. </xsl:attribute>
  91. <xsl:choose>
  92. <xsl:when test="$cmdsyn/@xreflabel">
  93. <xsl:call-template name="xref.xreflabel">
  94. <xsl:with-param name="target" select="$cmdsyn"/>
  95. </xsl:call-template>
  96. </xsl:when>
  97. <xsl:otherwise>
  98. <xsl:apply-templates select="$cmdsyn" mode="xref-to">
  99. <xsl:with-param name="target" select="$cmdsyn"/>
  100. </xsl:apply-templates>
  101. </xsl:otherwise>
  102. </xsl:choose>
  103. </a>
  104. </dt>
  105. <xsl:call-template name="process.cmdsynopsis.list">
  106. <xsl:with-param name="cmdsynopses" select="$cmdsynopses"/>
  107. <xsl:with-param name="count" select="$count+1"/>
  108. </xsl:call-template>
  109. </xsl:otherwise>
  110. </xsl:choose>
  111. </xsl:template>
  112. <xsl:template match="processing-instruction('dbcmdlist')">
  113. <xsl:variable name="cmdsynopses" select="..//cmdsynopsis"/>
  114. <xsl:if test="count($cmdsynopses)&lt;1">
  115. <xsl:message><xsl:text>No cmdsynopsis elements matched dbcmdlist PI, perhaps it's nested too deep?</xsl:text>
  116. </xsl:message>
  117. </xsl:if>
  118. <dl>
  119. <xsl:call-template name="process.cmdsynopsis.list">
  120. <xsl:with-param name="cmdsynopses" select="$cmdsynopses"/>
  121. </xsl:call-template>
  122. </dl>
  123. </xsl:template>
  124. <!-- ==================================================================== -->
  125. <xsl:template name="process.funcsynopsis.list">
  126. <xsl:param name="funcsynopses"/><!-- empty node list by default -->
  127. <xsl:param name="count" select="1"/>
  128. <xsl:choose>
  129. <xsl:when test="$count&gt;count($funcsynopses)"/>
  130. <xsl:otherwise>
  131. <xsl:variable name="cmdsyn" select="$funcsynopses[$count]"/>
  132. <dt>
  133. <a>
  134. <xsl:attribute name="href">
  135. <xsl:call-template name="object.id">
  136. <xsl:with-param name="object" select="$cmdsyn"/>
  137. </xsl:call-template>
  138. </xsl:attribute>
  139. <xsl:choose>
  140. <xsl:when test="$cmdsyn/@xreflabel">
  141. <xsl:call-template name="xref.xreflabel">
  142. <xsl:with-param name="target" select="$cmdsyn"/>
  143. </xsl:call-template>
  144. </xsl:when>
  145. <xsl:otherwise>
  146. <xsl:apply-templates select="$cmdsyn" mode="xref-to">
  147. <xsl:with-param name="target" select="$cmdsyn"/>
  148. </xsl:apply-templates>
  149. </xsl:otherwise>
  150. </xsl:choose>
  151. </a>
  152. </dt>
  153. <xsl:call-template name="process.funcsynopsis.list">
  154. <xsl:with-param name="funcsynopses" select="$funcsynopses"/>
  155. <xsl:with-param name="count" select="$count+1"/>
  156. </xsl:call-template>
  157. </xsl:otherwise>
  158. </xsl:choose>
  159. </xsl:template>
  160. <xsl:template match="processing-instruction('dbfunclist')">
  161. <xsl:variable name="funcsynopses" select="..//funcsynopsis"/>
  162. <xsl:if test="count($funcsynopses)&lt;1">
  163. <xsl:message><xsl:text>No funcsynopsis elements matched dbfunclist PI, perhaps it's nested too deep?</xsl:text>
  164. </xsl:message>
  165. </xsl:if>
  166. <dl>
  167. <xsl:call-template name="process.funcsynopsis.list">
  168. <xsl:with-param name="funcsynopses" select="$funcsynopses"/>
  169. </xsl:call-template>
  170. </dl>
  171. </xsl:template>
  172. <!-- ==================================================================== -->
  173. <!-- Copy well-formed external HTML content to the output. -->
  174. <!-- An optional <html> wrapper will be removed before content is copied
  175. to support multiple elements in output without a wrapper.
  176. No other processing is done to the content. -->
  177. <xsl:template match="processing-instruction('dbhtml-include')">
  178. <xsl:param name="href">
  179. <xsl:call-template name="dbhtml-attribute">
  180. <xsl:with-param name="pis" select="."/>
  181. <xsl:with-param name="attribute">href</xsl:with-param>
  182. </xsl:call-template>
  183. </xsl:param>
  184. <xsl:choose>
  185. <xsl:when test="$href != ''">
  186. <xsl:variable name="content" select="document($href,/)"/>
  187. <xsl:choose>
  188. <xsl:when test="$content/*">
  189. <xsl:choose>
  190. <xsl:when test="$content/*[1][self::html]">
  191. <!-- include just the children of html wrapper -->
  192. <xsl:copy-of select="$content/*[1]/node()"/>
  193. </xsl:when>
  194. <xsl:otherwise>
  195. <xsl:copy-of select="$content"/>
  196. </xsl:otherwise>
  197. </xsl:choose>
  198. </xsl:when>
  199. <xsl:otherwise>
  200. <xsl:message>
  201. <xsl:text>ERROR: dbhtml-include processing instruction </xsl:text>
  202. <xsl:text>href has no content.</xsl:text>
  203. </xsl:message>
  204. </xsl:otherwise>
  205. </xsl:choose>
  206. </xsl:when>
  207. <xsl:otherwise>
  208. <xsl:message>
  209. <xsl:text>ERROR: dbhtml-include processing instruction has </xsl:text>
  210. <xsl:text>missing or empty href value.</xsl:text>
  211. </xsl:message>
  212. </xsl:otherwise>
  213. </xsl:choose>
  214. </xsl:template>
  215. </xsl:stylesheet>