source: BOOK/stylesheets/lfs-xsl/pdf/lfs-lists.xsl@ bc49bea

sysvinit
Last change on this file since bc49bea was f8c4e94, checked in by Manuel Canales Esparcia <manuel@…>, 17 years ago

Added LFS XSL Stylesheets.

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