lfs-mixed.xsl 6.6 KB

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