lfs-mixed.xsl 7.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185
  1. <?xml version='1.0' encoding='ISO-8859-1'?>
  2. <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
  3. xmlns:fo="http://www.w3.org/1999/XSL/Format"
  4. version="1.0">
  5. <!-- This is a hack and isn't correct semantically. The beginpage tags must
  6. be placed in the XML source only to render the final PDF output, and must
  7. be removed after.-->
  8. <xsl:template match="beginpage">
  9. <fo:block break-after="page"/>
  10. </xsl:template>
  11. <!-- Split URLs -->
  12. <xsl:template name="hyphenate-url">
  13. <xsl:param name="url" select="''"/>
  14. <xsl:choose>
  15. <xsl:when test="ancestor::varlistentry">
  16. <xsl:choose>
  17. <xsl:when test="string-length($url) > 88">
  18. <xsl:value-of select="substring($url, 1, 50)"/>
  19. <xsl:param name="rest" select="substring($url, 51)"/>
  20. <xsl:value-of select="substring-before($rest, '/')"/>
  21. <xsl:text> /</xsl:text>
  22. <xsl:value-of select="substring-after($rest, '/')"/>
  23. </xsl:when>
  24. <xsl:otherwise>
  25. <xsl:value-of select="$url"/>
  26. </xsl:otherwise>
  27. </xsl:choose>
  28. </xsl:when>
  29. <xsl:otherwise>
  30. <xsl:value-of select="$url"/>
  31. <!-- <xsl:value-of select="substring-before($url, '//')"/>
  32. <xsl:text>// </xsl:text>
  33. <xsl:call-template name="split-url">
  34. <xsl:with-param name="url2" select="substring-after($url, '//')"/>
  35. </xsl:call-template>-->
  36. </xsl:otherwise>
  37. </xsl:choose>
  38. </xsl:template>
  39. <!--<xsl:template name="split-url">
  40. <xsl:choose>
  41. <xsl:when test="contains($url2, '/')">
  42. <xsl:param name="url2" select="''"/>
  43. <xsl:value-of select="substring-before($url2, '/')"/>
  44. <xsl:text> /</xsl:text>
  45. <xsl:call-template name="split-url">
  46. <xsl:with-param name="url2" select="substring-after($url2, '/')"/>
  47. </xsl:call-template>
  48. </xsl:when>
  49. <xsl:otherwise>
  50. <xsl:value-of select="$url2"/>
  51. </xsl:otherwise>
  52. </xsl:choose>
  53. </xsl:template>-->
  54. <!-- Shade screen -->
  55. <xsl:param name="shade.verbatim" select="1"/>
  56. <!-- Graphics in admonitions -->
  57. <xsl:param name="admon.graphics" select="1"/>
  58. <xsl:param name="admon.graphics.path"
  59. select="'/usr/share/xml/docbook/xsl-stylesheets-1.65.1/images/'"/>
  60. <!-- Admonition block properties -->
  61. <xsl:template match="important|warning|caution">
  62. <xsl:choose>
  63. <xsl:when test="$admon.graphics != 0">
  64. <fo:block space-before.minimum="0.4em" space-before.optimum="0.6em"
  65. space-before.maximum="0.8em" border-style="solid" border-width="1pt"
  66. border-color="#500" background-color="#FFFFE6">
  67. <xsl:call-template name="graphical.admonition"/>
  68. </fo:block>
  69. </xsl:when>
  70. <xsl:otherwise>
  71. <xsl:call-template name="nongraphical.admonition"/>
  72. </xsl:otherwise>
  73. </xsl:choose>
  74. </xsl:template>
  75. <xsl:template match="note|tip">
  76. <xsl:choose>
  77. <xsl:when test="$admon.graphics != 0">
  78. <fo:block space-before.minimum="0.4em" space-before.optimum="0.6em"
  79. space-before.maximum="0.8em" border-style="solid" border-width="1pt"
  80. border-color="#E0E0E0" background-color="#FFFFE6">
  81. <xsl:call-template name="graphical.admonition"/>
  82. </fo:block>
  83. </xsl:when>
  84. <xsl:otherwise>
  85. <xsl:call-template name="nongraphical.admonition"/>
  86. </xsl:otherwise>
  87. </xsl:choose>
  88. </xsl:template>
  89. <!-- Admonitions text properties -->
  90. <xsl:attribute-set name="admonition.properties">
  91. <xsl:attribute name="margin-right">6pt</xsl:attribute>
  92. </xsl:attribute-set>
  93. <!-- Adding left space to the graphics and color to the titles -->
  94. <xsl:template name="graphical.admonition">
  95. <xsl:variable name="id">
  96. <xsl:call-template name="object.id"/>
  97. </xsl:variable>
  98. <xsl:variable name="graphic.width">
  99. <xsl:call-template name="admon.graphic.width"/>
  100. </xsl:variable>
  101. <fo:block id="{$id}">
  102. <fo:list-block provisional-distance-between-starts="{$graphic.width} + 18pt"
  103. provisional-label-separation="18pt" xsl:use-attribute-sets="list.block.spacing">
  104. <fo:list-item>
  105. <fo:list-item-label end-indent="label-end()">
  106. <fo:block margin-left="4pt">
  107. <fo:external-graphic width="auto" height="auto"
  108. content-width="{$graphic.width}" >
  109. <xsl:attribute name="src">
  110. <xsl:call-template name="admon.graphic"/>
  111. </xsl:attribute>
  112. </fo:external-graphic>
  113. </fo:block>
  114. </fo:list-item-label>
  115. <fo:list-item-body start-indent="body-start()">
  116. <xsl:if test="$admon.textlabel != 0 or title">
  117. <fo:block xsl:use-attribute-sets="admonition.title.properties">
  118. <xsl:if test="ancestor-or-self::important">
  119. <xsl:attribute name="color">#500</xsl:attribute>
  120. </xsl:if>
  121. <xsl:if test="ancestor-or-self::warning">
  122. <xsl:attribute name="color">#500</xsl:attribute>
  123. </xsl:if>
  124. <xsl:if test="ancestor-or-self::caution">
  125. <xsl:attribute name="color">#500</xsl:attribute>
  126. </xsl:if>
  127. <xsl:apply-templates select="." mode="object.title.markup"/>
  128. </fo:block>
  129. </xsl:if>
  130. <fo:block xsl:use-attribute-sets="admonition.properties">
  131. <xsl:apply-templates/>
  132. </fo:block>
  133. </fo:list-item-body>
  134. </fo:list-item>
  135. </fo:list-block>
  136. </fo:block>
  137. </xsl:template>
  138. <!-- How is rendered by default a variablelist -->
  139. <xsl:param name="variablelist.as.blocks" select="1"/>
  140. <xsl:param name="variablelist.max.termlength">32</xsl:param>
  141. <!-- Adding space before segmentedlist -->
  142. <xsl:template match="segmentedlist">
  143. <!--<xsl:variable name="presentation">
  144. <xsl:call-template name="pi-attribute">
  145. <xsl:with-param name="pis"
  146. select="processing-instruction('dbfo')"/>
  147. <xsl:with-param name="attribute" select="'list-presentation'"/>
  148. </xsl:call-template>
  149. </xsl:variable>
  150. <xsl:choose>
  151. <xsl:when test="$presentation = 'table'">
  152. <xsl:apply-templates select="." mode="seglist-table"/>
  153. </xsl:when>
  154. <xsl:when test="$presentation = 'list'">
  155. <fo:block space-before.minimum="0.4em" space-before.optimum="0.6em"
  156. space-before.maximum="0.8em">
  157. <xsl:apply-templates/>
  158. </fo:block>
  159. </xsl:when>
  160. <xsl:when test="$segmentedlist.as.table != 0">
  161. <xsl:apply-templates select="." mode="seglist-table"/>
  162. </xsl:when>
  163. <xsl:otherwise>-->
  164. <fo:block space-before.minimum="0.4em" space-before.optimum="0.6em"
  165. space-before.maximum="0.8em">
  166. <xsl:apply-templates/>
  167. </fo:block>
  168. <!--</xsl:otherwise>
  169. </xsl:choose>-->
  170. </xsl:template>
  171. </xsl:stylesheet>