lfs-mixed.xsl 6.7 KB

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