lfs-mixed.xsl 7.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223
  1. <?xml version='1.0' encoding='ISO-8859-1'?>
  2. <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
  3. xmlns="http://www.w3.org/1999/xhtml"
  4. version="1.0">
  5. <!-- This stylesheet contains misc templates for output formating.
  6. This file is for that templates that don't fit in other files
  7. and that not afect the chunk algorithm. -->
  8. <!-- Individual elements templates -->
  9. <!-- para:
  10. Added a choose to skip empty "Home page" in packages.xml -->
  11. <!-- The original template is in {docbook-xsl}/xhtml/block.xsl -->
  12. <xsl:template match="para">
  13. <xsl:choose>
  14. <xsl:when test="child::ulink[@url=' ']"/>
  15. <xsl:otherwise>
  16. <xsl:call-template name="paragraph">
  17. <xsl:with-param name="class">
  18. <xsl:if test="@role and $para.propagates.style != 0">
  19. <xsl:value-of select="@role"/>
  20. </xsl:if>
  21. </xsl:with-param>
  22. <xsl:with-param name="content">
  23. <xsl:if test="position() = 1 and parent::listitem">
  24. <xsl:call-template name="anchor">
  25. <xsl:with-param name="node" select="parent::listitem"/>
  26. </xsl:call-template>
  27. </xsl:if>
  28. <xsl:call-template name="anchor"/>
  29. <xsl:apply-templates/>
  30. </xsl:with-param>
  31. </xsl:call-template>
  32. </xsl:otherwise>
  33. </xsl:choose>
  34. </xsl:template>
  35. <!-- screen:
  36. Changed class attribute asignament to fit our look needs.
  37. Removed unused line numbering support. -->
  38. <!-- The original template is in {docbook-xsl}/xhtml/verbatim.xsl
  39. It match also programlisting and synopsis. The code for that tags
  40. is unchanged. -->
  41. <xsl:template match="screen">
  42. <xsl:choose>
  43. <xsl:when test="child::* = userinput">
  44. <pre class="userinput">
  45. <xsl:apply-templates/>
  46. </pre>
  47. </xsl:when>
  48. <xsl:otherwise>
  49. <pre class="{name(.)}">
  50. <xsl:apply-templates/>
  51. </pre>
  52. </xsl:otherwise>
  53. </xsl:choose>
  54. </xsl:template>
  55. <!-- userinput:
  56. Using a customized output when inside screen.
  57. In other cases, use the original template. -->
  58. <!-- The original template is in {docbook-xsl}/xhtml/inline.xsl -->
  59. <xsl:template match="userinput">
  60. <xsl:choose>
  61. <xsl:when test="ancestor::screen">
  62. <kbd class="command">
  63. <xsl:apply-templates/>
  64. </kbd>
  65. </xsl:when>
  66. <xsl:otherwise>
  67. <xsl:apply-imports/>
  68. </xsl:otherwise>
  69. </xsl:choose>
  70. </xsl:template>
  71. <!-- seg in segementedlist:
  72. Added a span around seg text to can match it with CSS code. -->
  73. <!-- The original template is in {docbook-xsl}/xhtml/lists.xsl -->
  74. <xsl:template match="seg">
  75. <xsl:variable name="segnum" select="count(preceding-sibling::seg)+1"/>
  76. <xsl:variable name="seglist" select="ancestor::segmentedlist"/>
  77. <xsl:variable name="segtitles" select="$seglist/segtitle"/>
  78. <!-- Note: segtitle is only going to be the right thing in a well formed
  79. SegmentedList. If there are too many Segs or too few SegTitles,
  80. you'll get something odd...maybe an error -->
  81. <div class="seg">
  82. <strong>
  83. <span class="segtitle">
  84. <xsl:apply-templates select="$segtitles[$segnum=position()]" mode="segtitle-in-seg"/>
  85. <xsl:text>: </xsl:text>
  86. </span>
  87. </strong>
  88. <span class="seg">
  89. <xsl:apply-templates/>
  90. </span>
  91. </div>
  92. </xsl:template>
  93. <!-- variablelist:
  94. If it have a role attribute, wrap the default output into a div with
  95. a class attribute matching that role attribute.
  96. Apply the original template in all cases. -->
  97. <!-- The original template is in {docbook-xsl}/xhtml/lists.xsl -->
  98. <xsl:template match="variablelist">
  99. <xsl:choose>
  100. <xsl:when test="@role">
  101. <div class="{@role}">
  102. <xsl:apply-imports/>
  103. </div>
  104. </xsl:when>
  105. <xsl:otherwise>
  106. <xsl:apply-imports/>
  107. </xsl:otherwise>
  108. </xsl:choose>
  109. </xsl:template>
  110. <!-- Named formating templates -->
  111. <!-- Body attributes:
  112. Add to the body XHTML output tag a class attribute with the book type
  113. and a id atribute with the book ty and version. -->
  114. <!-- The original template is in {docbook-xsl}/xhtml/docbook.xsl -->
  115. <xsl:template name="body.attributes">
  116. <xsl:attribute name="class">
  117. <xsl:value-of select="$book-type"/>
  118. </xsl:attribute>
  119. <xsl:attribute name="id">
  120. <xsl:value-of select="$book-type"/>
  121. <xsl:text>-</xsl:text>
  122. <xsl:value-of select="substring-after(/book/bookinfo/subtitle, ' ')"/>
  123. </xsl:attribute>
  124. </xsl:template>
  125. <!-- inline.monoseq:
  126. The code xhtml tag have look issues in some browsers.
  127. We will use tt instead. -->
  128. <!-- The original template is in {docbook-xsl}/xhtml/inline.xsl -->
  129. <xsl:template name="inline.monoseq">
  130. <xsl:param name="content">
  131. <xsl:call-template name="anchor"/>
  132. <xsl:call-template name="simple.xlink">
  133. <xsl:with-param name="content">
  134. <xsl:apply-templates/>
  135. </xsl:with-param>
  136. </xsl:call-template>
  137. </xsl:param>
  138. <tt>
  139. <xsl:apply-templates select="." mode="class.attribute"/>
  140. <xsl:call-template name="dir"/>
  141. <xsl:call-template name="generate.html.title"/>
  142. <xsl:copy-of select="$content"/>
  143. <xsl:call-template name="apply-annotations"/>
  144. </tt>
  145. </xsl:template>
  146. <!-- inline.boldmonoseq:
  147. The code xhtml tag have look issues in some browsers.
  148. We will use tt instead. -->
  149. <!-- The original template is in {docbook-xsl}/xhtml/inline.xsl -->
  150. <xsl:template name="inline.boldmonoseq">
  151. <xsl:param name="content">
  152. <xsl:call-template name="anchor"/>
  153. <xsl:call-template name="simple.xlink">
  154. <xsl:with-param name="content">
  155. <xsl:apply-templates/>
  156. </xsl:with-param>
  157. </xsl:call-template>
  158. </xsl:param>
  159. <!-- don't put <strong> inside figure, example, or table titles
  160. or other titles that may already be represented with <strong>'s. -->
  161. <xsl:choose>
  162. <xsl:when test="local-name(..) = 'title' and (local-name(../..) = 'figure'
  163. or local-name(../..) = 'example' or local-name(../..) = 'table'
  164. or local-name(../..) = 'formalpara')">
  165. <tt>
  166. <xsl:apply-templates select="." mode="class.attribute"/>
  167. <xsl:call-template name="generate.html.title"/>
  168. <xsl:call-template name="dir"/>
  169. <xsl:copy-of select="$content"/>
  170. <xsl:call-template name="apply-annotations"/>
  171. </tt>
  172. </xsl:when>
  173. <xsl:otherwise>
  174. <strong>
  175. <xsl:apply-templates select="." mode="class.attribute"/>
  176. <tt>
  177. <xsl:call-template name="generate.html.title"/>
  178. <xsl:call-template name="dir"/>
  179. <xsl:copy-of select="$content"/>
  180. </tt>
  181. </strong>
  182. </xsl:otherwise>
  183. </xsl:choose>
  184. </xsl:template>
  185. <!-- inline.italicmonoseq:
  186. The code xhtml tag have look issues in some browsers.
  187. We will use tt instead. -->
  188. <!-- The original template is in {docbook-xsl}/xhtml/inline.xsl -->
  189. <xsl:template name="inline.italicmonoseq">
  190. <xsl:param name="content">
  191. <xsl:call-template name="anchor"/>
  192. <xsl:call-template name="simple.xlink">
  193. <xsl:with-param name="content">
  194. <xsl:apply-templates/>
  195. </xsl:with-param>
  196. </xsl:call-template>
  197. </xsl:param>
  198. <em>
  199. <xsl:apply-templates select="." mode="class.attribute"/>
  200. <tt>
  201. <xsl:call-template name="generate.html.title"/>
  202. <xsl:call-template name="dir"/>
  203. <xsl:copy-of select="$content"/>
  204. <xsl:call-template name="apply-annotations"/>
  205. </tt>
  206. </em>
  207. </xsl:template>
  208. </xsl:stylesheet>