source: BOOK/stylesheets/lfs-xsl/xhtml/lfs-mixed.xsl@ 05efce1

clfs-3.0.0-systemd clfs-3.0.0-sysvinit systemd sysvinit
Last change on this file since 05efce1 was f8c4e94, checked in by Manuel Canales Esparcia <manuel@…>, 17 years ago

Added LFS XSL Stylesheets.

  • Property mode set to 100644
File size: 11.0 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="http://www.w3.org/1999/xhtml"
10 version="1.0">
11
12 <!-- This stylesheet contains misc templates for output formating.
13 This file is for that templates that don't fit in other files
14 and that not afect the chunk algorithm. -->
15
16 <!-- Individual elements templates -->
17
18 <!-- para:
19 Added a choose to skip empty "Home page" in packages.xml.
20 Added an if for HLFS features. -->
21 <!-- The original template is in {docbook-xsl}/xhtml/block.xsl -->
22 <xsl:template match="para">
23 <xsl:choose>
24 <xsl:when test="child::ulink[@url=' ']"/>
25 <xsl:otherwise>
26 <xsl:call-template name="paragraph">
27 <xsl:with-param name="class">
28 <xsl:if test="@role">
29 <xsl:if test="$book-type = 'hlfs'">
30 <xsl:if test="contains($hlfs-features,concat(',',@role,','))">
31 <xsl:text>feature-</xsl:text>
32 </xsl:if>
33 </xsl:if>
34 <xsl:value-of select="@role"/>
35 </xsl:if>
36 </xsl:with-param>
37 <xsl:with-param name="content">
38 <xsl:if test="position() = 1 and parent::listitem">
39 <xsl:call-template name="anchor">
40 <xsl:with-param name="node" select="parent::listitem"/>
41 </xsl:call-template>
42 </xsl:if>
43 <xsl:call-template name="anchor"/>
44 <xsl:apply-templates/>
45 </xsl:with-param>
46 </xsl:call-template>
47 </xsl:otherwise>
48 </xsl:choose>
49 </xsl:template>
50
51 <!-- screen:
52 Changed class attribute asignament to fit our look needs.
53 Removed unused line numbering support. -->
54 <!-- The original template is in {docbook-xsl}/xhtml/verbatim.xsl
55 It match also programlisting and synopsis. The code for that tags
56 is unchanged. -->
57 <xsl:template match="screen">
58 <pre>
59 <xsl:attribute name="class">
60 <xsl:choose>
61 <xsl:when test="@role and not(@role = 'nodump')">
62 <xsl:if test="$book-type = 'hlfs'">
63 <xsl:if test="contains($hlfs-features,concat(',',@role,','))">
64 <xsl:text>feature-</xsl:text>
65 </xsl:if>
66 </xsl:if>
67 <xsl:value-of select="@role"/>
68 </xsl:when>
69 <xsl:when test="child::* = userinput">userinput</xsl:when>
70 <xsl:otherwise>
71 <xsl:value-of select="name(.)"/>
72 </xsl:otherwise>
73 </xsl:choose>
74 </xsl:attribute>
75 <xsl:apply-templates/>
76 </pre>
77 </xsl:template>
78
79 <!-- userinput:
80 Using a customized output when inside screen.
81 In other cases, use the original template. -->
82 <!-- The original template is in {docbook-xsl}/xhtml/inline.xsl -->
83 <xsl:template match="userinput">
84 <xsl:choose>
85 <xsl:when test="ancestor::screen">
86 <kbd class="command">
87 <xsl:apply-templates/>
88 </kbd>
89 </xsl:when>
90 <xsl:otherwise>
91 <xsl:apply-imports/>
92 </xsl:otherwise>
93 </xsl:choose>
94 </xsl:template>
95
96 <!-- itemizadlist:
97 @compact is not allowed in XHTML 1.0 Strict DTD. Changing it
98 to @class. -->
99 <!-- The original template is in {docbook-xsl}/xhtml/lists.xsl -->
100 <xsl:template match="itemizedlist">
101 <div>
102 <xsl:apply-templates select="." mode="class.attribute"/>
103 <xsl:call-template name="anchor"/>
104 <xsl:if test="title">
105 <xsl:call-template name="formal.object.heading"/>
106 </xsl:if>
107 <xsl:apply-templates select="*[not(self::listitem or self::title
108 or self::titleabbrev)]
109 |comment()[not(preceding-sibling::listitem)]
110 |processing-instruction()[not(preceding-sibling::listitem)]"/>
111 <ul>
112 <xsl:if test="@spacing='compact'">
113 <xsl:attribute name="class">
114 <xsl:value-of select="@spacing"/>
115 </xsl:attribute>
116 </xsl:if>
117 <xsl:apply-templates select="listitem |comment()[preceding-sibling::listitem]
118 |processing-instruction()[preceding-sibling::listitem]"/>
119 </ul>
120 </div>
121 </xsl:template>
122
123 <!-- orderedlist:
124 @start, @type, and @compact sre not allowed in XHTML 1.0 Strict DTD.
125 @start and @type can be replaced by CSS code.
126 Changing @compact to @class. -->
127 <!-- The original template is in {docbook-xsl}/xhtml/lists.xsl -->
128 <xsl:template match="orderedlist">
129 <div>
130 <xsl:apply-templates select="." mode="class.attribute"/>
131 <xsl:call-template name="anchor"/>
132 <xsl:if test="title">
133 <xsl:call-template name="formal.object.heading"/>
134 </xsl:if>
135 <xsl:apply-templates select="*[not(self::listitem or self::title
136 or self::titleabbrev)]
137 |comment()[not(preceding-sibling::listitem)]
138 |processing-instruction()[not(preceding-sibling::listitem)]"/>
139 <ol>
140 <xsl:if test="@spacing='compact'">
141 <xsl:attribute name="class">
142 <xsl:value-of select="@spacing"/>
143 </xsl:attribute>
144 </xsl:if>
145 <xsl:apply-templates select="listitem |comment()[preceding-sibling::listitem]
146 |processing-instruction()[preceding-sibling::listitem]"/>
147 </ol>
148 </div>
149 </xsl:template>
150
151 <!-- seg in segementedlist:
152 Added a span around seg text to can match it with CSS code. -->
153 <!-- The original template is in {docbook-xsl}/xhtml/lists.xsl -->
154 <xsl:template match="seg">
155 <xsl:variable name="segnum" select="count(preceding-sibling::seg)+1"/>
156 <xsl:variable name="seglist" select="ancestor::segmentedlist"/>
157 <xsl:variable name="segtitles" select="$seglist/segtitle"/>
158 <!-- Note: segtitle is only going to be the right thing in a well formed
159 SegmentedList. If there are too many Segs or too few SegTitles,
160 you'll get something odd...maybe an error -->
161 <div class="seg">
162 <strong class="segtitle">
163 <xsl:apply-templates select="$segtitles[$segnum=position()]"
164 mode="segtitle-in-seg"/>
165 <xsl:text>: </xsl:text>
166 </strong>
167 <span class="segbody">
168 <xsl:if test="@id">
169 <a id="{@id}" name="{@id}"/>
170 </xsl:if>
171 <xsl:apply-templates/>
172 </span>
173 </div>
174 </xsl:template>
175
176 <!-- variablelist:
177 If it have a role attribute, wrap the default output into a div with
178 a class attribute matching that role attribute.
179 Apply the original template in all cases. -->
180 <!-- The original template is in {docbook-xsl}/xhtml/lists.xsl -->
181 <xsl:template match="variablelist">
182 <xsl:choose>
183 <xsl:when test="@role">
184 <div class="{@role}">
185 <xsl:apply-imports/>
186 </div>
187 </xsl:when>
188 <xsl:otherwise>
189 <xsl:apply-imports/>
190 </xsl:otherwise>
191 </xsl:choose>
192 </xsl:template>
193
194 <!-- para/simplelist:
195 Self-made template. Add a line break and process the childs.
196 If @type is specified, the original templates should be used,
197 but not tested. -->
198 <xsl:template match="para/simplelist">
199 <br/>
200 <xsl:apply-templates mode="condensed"/>
201 </xsl:template>
202
203 <!-- member:
204 Self-made template to process it and add a line break. -->
205 <xsl:template match="member" mode="condensed">
206 <xsl:call-template name="anchor"/>
207 <xsl:call-template name="simple.xlink">
208 <xsl:with-param name="content">
209 <xsl:apply-templates/>
210 </xsl:with-param>
211 </xsl:call-template>
212 <br/>
213 </xsl:template>
214
215
216 <!-- Named formating templates -->
217
218 <!-- Body attributes:
219 Add to the body XHTML output tag a class attribute with the book type
220 and a id atribute with the book type and version. -->
221 <!-- The original template is in {docbook-xsl}/xhtml/docbook.xsl -->
222 <xsl:template name="body.attributes">
223 <xsl:attribute name="class">
224 <xsl:value-of select="$book-type"/>
225 </xsl:attribute>
226 <xsl:attribute name="id">
227 <xsl:value-of select="$book-type"/>
228 <xsl:text>-</xsl:text>
229 <xsl:value-of select="substring-after(/book/bookinfo/subtitle, ' ')"/>
230 </xsl:attribute>
231 </xsl:template>
232
233 <!-- Revision History -->
234
235 <!-- revhistory mode titlepage.mode:
236 Removed hardcoded style attributes.
237 Removed support for separate revhistory file. -->
238 <!-- The original template is in {docbook-xsl}/xhtml/titlepage.xsl -->
239 <xsl:template match="revhistory" mode="titlepage.mode">
240 <xsl:variable name="numcols">
241 <xsl:choose>
242 <xsl:when test="//authorinitials">4</xsl:when>
243 <xsl:otherwise>3</xsl:otherwise>
244 </xsl:choose>
245 </xsl:variable>
246 <xsl:variable name="title">
247 <xsl:call-template name="gentext">
248 <xsl:with-param name="key">RevHistory</xsl:with-param>
249 </xsl:call-template>
250 </xsl:variable>
251 <xsl:variable name="contents">
252 <table summary="{$title}" class="{name(.)}">
253 <tr>
254 <th colspan="{$numcols}">
255 <b>
256 <xsl:value-of select="$title"/>
257 </b>
258 </th>
259 </tr>
260 <xsl:apply-templates mode="titlepage.mode">
261 <xsl:with-param name="numcols" select="$numcols"/>
262 </xsl:apply-templates>
263 </table>
264 </xsl:variable>
265 <xsl:copy-of select="$contents"/>
266 </xsl:template>
267
268 <!-- revhistory/revision mode titlepage.mode:
269 Removed hardcoded style attributes. -->
270 <!-- The original template is in {docbook-xsl}/xhtml/titlepage.xsl -->
271 <xsl:template match="revhistory/revision" mode="titlepage.mode">
272 <xsl:param name="numcols" select="'3'"/>
273 <xsl:variable name="revnumber" select="revnumber"/>
274 <xsl:variable name="revdate" select="date"/>
275 <xsl:variable name="revauthor" select="authorinitials|author"/>
276 <xsl:variable name="revremark" select="revremark|revdescription"/>
277 <tr>
278 <td>
279 <xsl:if test="$revnumber">
280 <xsl:call-template name="gentext">
281 <xsl:with-param name="key" select="'Revision'"/>
282 </xsl:call-template>
283 <xsl:call-template name="gentext.space"/>
284 <xsl:apply-templates select="$revnumber[1]" mode="titlepage.mode"/>
285 </xsl:if>
286 </td>
287 <td>
288 <xsl:apply-templates select="$revdate[1]" mode="titlepage.mode"/>
289 </td>
290 <xsl:choose>
291 <xsl:when test="$revauthor">
292 <td>
293 <xsl:for-each select="$revauthor">
294 <xsl:apply-templates select="." mode="titlepage.mode"/>
295 <xsl:if test="position() != last()">
296 <xsl:text>, </xsl:text>
297 </xsl:if>
298 </xsl:for-each>
299 </td>
300 </xsl:when>
301 <xsl:when test="$numcols &gt; 3">
302 <td>&#160;</td>
303 </xsl:when>
304 <xsl:otherwise/>
305 </xsl:choose>
306 <td>
307 <xsl:apply-templates select="$revremark[1]" mode="titlepage.mode"/>
308 </td>
309 </tr>
310 </xsl:template>
311
312</xsl:stylesheet>
Note: See TracBrowser for help on using the repository browser.