lfs-lists.xsl 7.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174
  1. <?xml version='1.0' encoding='ISO-8859-1'?>
  2. <!--
  3. $LastChangedBy$
  4. $Date$
  5. -->
  6. <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
  7. xmlns:fo="http://www.w3.org/1999/XSL/Format"
  8. version="1.0">
  9. <!-- This stylesheet controls how list are generated. -->
  10. <!-- What spacing do you want before and after lists? -->
  11. <xsl:attribute-set name="list.block.spacing">
  12. <xsl:attribute name="space-before.optimum">0.6em</xsl:attribute>
  13. <xsl:attribute name="space-before.minimum">0.4em</xsl:attribute>
  14. <xsl:attribute name="space-before.maximum">0.8em</xsl:attribute>
  15. <xsl:attribute name="space-after.optimum">0.6em</xsl:attribute>
  16. <xsl:attribute name="space-after.minimum">0.4em</xsl:attribute>
  17. <xsl:attribute name="space-after.maximum">0.8em</xsl:attribute>
  18. </xsl:attribute-set>
  19. <!-- What spacing do you want between list items? -->
  20. <xsl:attribute-set name="list.item.spacing">
  21. <xsl:attribute name="space-before.optimum">0.4em</xsl:attribute>
  22. <xsl:attribute name="space-before.minimum">0.2em</xsl:attribute>
  23. <xsl:attribute name="space-before.maximum">0.6em</xsl:attribute>
  24. </xsl:attribute-set>
  25. <!-- Properties that apply to each list-block generated by itemizedlist. -->
  26. <xsl:attribute-set name="itemizedlist.properties"
  27. use-attribute-sets="list.block.properties">
  28. <xsl:attribute name="text-align">left</xsl:attribute>
  29. </xsl:attribute-set>
  30. <!-- Format variablelists lists as blocks? 1 = yes, 0 = no
  31. Default variablelist format. We override it when necessary
  32. using the list-presentation processing instruction. -->
  33. <xsl:param name="variablelist.as.blocks" select="1"/>
  34. <!-- Specifies the longest term in variablelists.
  35. Used when list-presentation = list -->
  36. <xsl:param name="variablelist.max.termlength">35</xsl:param>
  37. <!-- varlistentry mode block:
  38. Addibg a bullet, left alignament, and @kepp-*.* attributes
  39. for packages and paches list. -->
  40. <!-- The original template is in {docbook-xsl}/fo/list.xsl -->
  41. <xsl:template match="varlistentry" mode="vl.as.blocks">
  42. <xsl:variable name="id"><xsl:call-template name="object.id"/></xsl:variable>
  43. <xsl:choose>
  44. <xsl:when test="ancestor::variablelist/@role = 'materials'">
  45. <fo:block id="{$id}" xsl:use-attribute-sets="list.item.spacing"
  46. keep-together.within-column="always" font-weight="bold"
  47. keep-with-next.within-column="always" text-align="left">
  48. <xsl:text>&#x2022; </xsl:text>
  49. <xsl:apply-templates select="term"/>
  50. </fo:block>
  51. <fo:block text-align="left"
  52. keep-together.within-column="always"
  53. keep-with-previous.within-column="always">
  54. <xsl:apply-templates select="listitem"/>
  55. </fo:block>
  56. </xsl:when>
  57. <xsl:otherwise>
  58. <fo:block id="{$id}" xsl:use-attribute-sets="list.item.spacing"
  59. keep-together.within-column="always"
  60. keep-with-next.within-column="always" margin-left="1em">
  61. <xsl:apply-templates select="term"/>
  62. </fo:block>
  63. <fo:block margin-left="2em">
  64. <xsl:apply-templates select="listitem"/>
  65. </fo:block>
  66. </xsl:otherwise>
  67. </xsl:choose>
  68. </xsl:template>
  69. <!-- segmentedlist:
  70. Making it an actual FO list to can indent items.
  71. Adjust vertical space. -->
  72. <!-- The original template is in {docbook-xsl}/fo/list.xsl -->
  73. <xsl:template match="segmentedlist">
  74. <xsl:variable name="id">
  75. <xsl:call-template name="object.id"/>
  76. </xsl:variable>
  77. <fo:list-block id="{$id}" provisional-distance-between-starts="12em"
  78. provisional-label-separation="1em"
  79. keep-together.within-column="always">
  80. <xsl:choose>
  81. <xsl:when test="ancestor::appendix[@id='appendixc']">
  82. <xsl:attribute name="space-before.optimum">0.2em</xsl:attribute>
  83. <xsl:attribute name="space-before.minimum">0em</xsl:attribute>
  84. <xsl:attribute name="space-before.maximum">0.4em</xsl:attribute>
  85. <xsl:attribute name="space-after.optimum">0.2em</xsl:attribute>
  86. <xsl:attribute name="space-after.minimum">0em</xsl:attribute>
  87. <xsl:attribute name="space-after.maximum">0.4em</xsl:attribute>
  88. <xsl:attribute name="keep-with-previous.within-column">always</xsl:attribute>
  89. </xsl:when>
  90. <xsl:otherwise>
  91. <xsl:attribute name="space-before.optimum">0.4em</xsl:attribute>
  92. <xsl:attribute name="space-before.minimum">0.2em</xsl:attribute>
  93. <xsl:attribute name="space-before.maximum">0.6em</xsl:attribute>
  94. <xsl:attribute name="space-after.optimum">0.4em</xsl:attribute>
  95. <xsl:attribute name="space-after.minimum">0.2em</xsl:attribute>
  96. <xsl:attribute name="space-after.maximum">0.6em</xsl:attribute>
  97. </xsl:otherwise>
  98. </xsl:choose>
  99. <xsl:apply-templates select="seglistitem/seg"/>
  100. </fo:list-block>
  101. </xsl:template>
  102. <!-- seg:
  103. Self-made template based on the original seg template
  104. found in {docbook-xsl}/fo/list.xsl
  105. Making segmentedlist an actual FO list to can indent items. -->
  106. <xsl:template match="seglistitem/seg">
  107. <xsl:variable name="id">
  108. <xsl:call-template name="object.id"/>
  109. </xsl:variable>
  110. <xsl:variable name="segnum" select="count(preceding-sibling::seg)+1"/>
  111. <xsl:variable name="seglist" select="ancestor::segmentedlist"/>
  112. <xsl:variable name="segtitles" select="$seglist/segtitle"/>
  113. <fo:list-item xsl:use-attribute-sets="compact.list.item.spacing">
  114. <fo:list-item-label end-indent="label-end()" text-align="start">
  115. <fo:block>
  116. <fo:inline font-weight="bold">
  117. <xsl:apply-templates select="$segtitles[$segnum=position()]"
  118. mode="segtitle-in-seg"/>
  119. <xsl:text>:</xsl:text>
  120. </fo:inline>
  121. </fo:block>
  122. </fo:list-item-label>
  123. <fo:list-item-body start-indent="body-start()">
  124. <fo:block id="{$id}">
  125. <xsl:apply-templates/>
  126. </fo:block>
  127. </fo:list-item-body>
  128. </fo:list-item>
  129. </xsl:template>
  130. <!-- simplelist:
  131. Self-made template. Wrap it into a fo:block and process member childs.
  132. If @type is specified, the original templates will be used.
  133. NOTE: when using type='horiz' or type='vert', FOP-0.93 will complaints
  134. about not supported table-layout="auto" -->
  135. <xsl:template match="simplelist">
  136. <fo:block xsl:use-attribute-sets="simplelist.properties">
  137. <xsl:apply-templates mode="condensed"/>
  138. </fo:block>
  139. </xsl:template>
  140. <!-- member:
  141. Self-made template to wrap it into a fo:block using customized
  142. properties. -->
  143. <xsl:template match="member" mode="condensed">
  144. <fo:block xsl:use-attribute-sets="simplelist.properties">
  145. <xsl:call-template name="simple.xlink">
  146. <xsl:with-param name="content">
  147. <xsl:apply-templates/>
  148. </xsl:with-param>
  149. </xsl:call-template>
  150. </fo:block>
  151. </xsl:template>
  152. <!-- Properties associated with our simplelist format. -->
  153. <xsl:attribute-set name="simplelist.properties">
  154. <xsl:attribute name="keep-with-previous.within-column">always</xsl:attribute>
  155. <xsl:attribute name="space-before.optimum">0em</xsl:attribute>
  156. <xsl:attribute name="space-before.minimum">0em</xsl:attribute>
  157. <xsl:attribute name="space-before.maximum">0.2em</xsl:attribute>
  158. </xsl:attribute-set>
  159. </xsl:stylesheet>