lfs-mixed.xsl 6.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180
  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. <fo:block id="{$id}">
  99. <fo:list-block xsl:use-attribute-sets="list.block.spacing">
  100. <fo:list-item>
  101. <fo:list-item-label end-indent="label-end()">
  102. <fo:block margin-left="4pt">
  103. <fo:external-graphic width="auto" height="auto">
  104. <xsl:attribute name="src">
  105. <xsl:call-template name="admon.graphic"/>
  106. </xsl:attribute>
  107. </fo:external-graphic>
  108. </fo:block>
  109. </fo:list-item-label>
  110. <fo:list-item-body start-indent="body-start()">
  111. <xsl:if test="$admon.textlabel != 0 or title">
  112. <fo:block xsl:use-attribute-sets="admonition.title.properties">
  113. <xsl:if test="ancestor-or-self::important">
  114. <xsl:attribute name="color">#500</xsl:attribute>
  115. </xsl:if>
  116. <xsl:if test="ancestor-or-self::warning">
  117. <xsl:attribute name="color">#500</xsl:attribute>
  118. </xsl:if>
  119. <xsl:if test="ancestor-or-self::caution">
  120. <xsl:attribute name="color">#500</xsl:attribute>
  121. </xsl:if>
  122. <xsl:apply-templates select="." mode="object.title.markup"/>
  123. </fo:block>
  124. </xsl:if>
  125. <fo:block xsl:use-attribute-sets="admonition.properties">
  126. <xsl:apply-templates/>
  127. </fo:block>
  128. </fo:list-item-body>
  129. </fo:list-item>
  130. </fo:list-block>
  131. </fo:block>
  132. </xsl:template>
  133. <!-- How is rendered by default a variablelist -->
  134. <xsl:param name="variablelist.as.blocks" select="1"/>
  135. <xsl:param name="variablelist.max.termlength">32</xsl:param>
  136. <!-- Adding space before segmentedlist -->
  137. <xsl:template match="segmentedlist">
  138. <!--<xsl:variable name="presentation">
  139. <xsl:call-template name="pi-attribute">
  140. <xsl:with-param name="pis"
  141. select="processing-instruction('dbfo')"/>
  142. <xsl:with-param name="attribute" select="'list-presentation'"/>
  143. </xsl:call-template>
  144. </xsl:variable>
  145. <xsl:choose>
  146. <xsl:when test="$presentation = 'table'">
  147. <xsl:apply-templates select="." mode="seglist-table"/>
  148. </xsl:when>
  149. <xsl:when test="$presentation = 'list'">
  150. <fo:block space-before.minimum="0.4em" space-before.optimum="0.6em"
  151. space-before.maximum="0.8em">
  152. <xsl:apply-templates/>
  153. </fo:block>
  154. </xsl:when>
  155. <xsl:when test="$segmentedlist.as.table != 0">
  156. <xsl:apply-templates select="." mode="seglist-table"/>
  157. </xsl:when>
  158. <xsl:otherwise>-->
  159. <fo:block space-before.minimum="0.4em" space-before.optimum="0.6em"
  160. space-before.maximum="0.8em">
  161. <xsl:apply-templates/>
  162. </fo:block>
  163. <!--</xsl:otherwise>
  164. </xsl:choose>-->
  165. </xsl:template>
  166. </xsl:stylesheet>