lfs-lists.xsl 7.4 KB

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