source: BLFS/xsl/make_book.xsl@ 83cfe91

trunk
Last change on this file since 83cfe91 was 83cfe91, checked in by Pierre Labastie <pierre.labastie@…>, 3 days ago

fix building xcb-utilities
Fixes ticket #1741

  • Property mode set to 100644
File size: 33.0 KB
Line 
1<?xml version="1.0" encoding="ISO-8859-1"?>
2
3<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
4 version="1.0">
5
6 <xsl:param name="list" select="''"/>
7 <xsl:param name="MTA" select="'sendmail'"/>
8 <xsl:param name="lfsbook" select="'lfs-full.xml'"/>
9
10<!-- Check whether the book is sysv or systemd -->
11 <xsl:variable name="rev">
12 <xsl:choose>
13 <xsl:when test="//bookinfo/title/phrase[@revision='systemd']">
14 <xsl:text>systemd</xsl:text>
15 </xsl:when>
16 <xsl:otherwise>
17 <xsl:text>sysv</xsl:text>
18 </xsl:otherwise>
19 </xsl:choose>
20 </xsl:variable>
21
22 <xsl:output
23 method="xml"
24 encoding="ISO-8859-1"
25 doctype-system="http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd"/>
26
27 <xsl:include href="lfs_make_book.xsl"/>
28
29 <xsl:template match="/">
30 <book>
31 <xsl:copy-of select="/book/bookinfo"/>
32 <preface>
33 <?dbhtml filename="preface.html"?>
34 <title>Preface</title>
35 <xsl:choose>
36 <xsl:when test="$rev='sysv'">
37 <xsl:copy-of select="id('bootscripts')"/>
38 </xsl:when>
39 <xsl:otherwise>
40 <xsl:copy-of select="id('systemd-units')"/>
41 </xsl:otherwise>
42 </xsl:choose>
43 </preface>
44 <chapter>
45 <?dbhtml filename="chapter.html"?>
46 <title>Installing packages in dependency build order</title>
47 <xsl:call-template name="apply-list">
48 <xsl:with-param name="list" select="normalize-space($list)"/>
49 </xsl:call-template>
50 </chapter>
51 <xsl:copy-of select="id('CC')"/>
52 <xsl:copy-of select="id('MIT')"/>
53 <index/>
54 </book>
55 </xsl:template>
56
57<!-- apply-templates for each item in the list.
58 Normally, those items are id of nodes.
59 Those nodes can be sect1 (normal case),
60 sect2 (python/perl modules/dependencies )
61 The templates after this one treat each of those cases.
62 However, some items are sub-packages of compound packages (xorg7-*,
63 kf5, plasma), and not id.
64 We need special instructions in that case.
65 The difficulty is that some of those names *are* id's,
66 because they are referenced in the index.
67 Hopefully, none of those id's are sect{1,2}...
68 We also need a special template for plasma-post-install,
69 because this one is not an id at all!-->
70 <xsl:template name="apply-list">
71 <xsl:param name="list" select="''"/>
72 <xsl:if test="string-length($list) &gt; 0">
73 <xsl:choose>
74 <!-- iterate if there are several packages in list -->
75 <xsl:when test="contains($list,' ')">
76 <xsl:call-template name="apply-list">
77 <xsl:with-param name="list"
78 select="substring-before($list,' ')"/>
79 </xsl:call-template>
80 <xsl:call-template name="apply-list">
81 <xsl:with-param name="list"
82 select="substring-after($list,' ')"/>
83 </xsl:call-template>
84 </xsl:when>
85 <!-- From now on, $list contains only one package -->
86 <!-- If it is a group, do nothing -->
87 <xsl:when test="contains($list,'groupxx')"/>
88 <xsl:otherwise>
89 <xsl:variable name="is-lfs">
90 <xsl:call-template name="detect-lfs">
91 <xsl:with-param name="package" select="$list"/>
92 <xsl:with-param name="lfsbook" select="$lfsbook"/>
93 </xsl:call-template>
94 </xsl:variable>
95 <xsl:choose>
96 <xsl:when test="$is-lfs='true'">
97 <!-- LFS package -->
98 <xsl:message>
99 <xsl:value-of select="$list"/>
100 <xsl:text> is an lfs package</xsl:text>
101 </xsl:message>
102 <xsl:call-template name="process-lfs">
103 <xsl:with-param name="package" select="$list"/>
104 <xsl:with-param name="lfsbook" select="$lfsbook"/>
105 </xsl:call-template>
106 </xsl:when>
107 <xsl:when test="contains(concat($list,' '),'-pass1 ')">
108<!-- We need to do it for both sect1 and sect2, because of libva -->
109 <xsl:variable
110 name="real-id"
111 select="substring-before(concat($list,' '),'-pass1 ')"/>
112 <xsl:if test="id($real-id)[self::sect1]">
113 <xsl:apply-templates select="id($real-id)" mode="pass1"/>
114 </xsl:if>
115 <xsl:if test="id($real-id)[self::sect2]">
116 <xsl:apply-templates select="id($real-id)" mode="pass1-sect2"/>
117 </xsl:if>
118 </xsl:when>
119 <xsl:when test="$list='plasma-post-install'">
120 <xsl:apply-templates
121 select="//sect1[@id='plasma5-build']"
122 mode="plasma-post-install"/>
123 </xsl:when>
124 <xsl:when test="not(id($list)[self::sect1 or self::sect2])">
125 <!-- This is a sub-package: parse the corresponding compound
126 package-->
127 <xsl:apply-templates
128 select="//sect1[(contains(@id,'xorg7') or
129 contains(@id,'frameworks') or
130 contains(@id,'plasma5') or
131 contains(@id,'xcb-utilities'))
132 and .//userinput/literal[contains(string(),
133 concat($list,'-'))]]"
134 mode="compound">
135 <xsl:with-param name="package" select="$list"/>
136 </xsl:apply-templates>
137 </xsl:when>
138 <xsl:otherwise>
139 <xsl:apply-templates select="id($list)"/>
140 </xsl:otherwise>
141 </xsl:choose>
142 </xsl:otherwise>
143 </xsl:choose>
144 </xsl:if>
145 </xsl:template>
146
147<!-- The normal case : just copy to the book. Exceptions are if there
148 is a xref, so use a special "mode" template -->
149 <xsl:template match="sect1">
150 <xsl:apply-templates select="." mode="sect1"/>
151 </xsl:template>
152
153 <xsl:template match="*" mode="pass1">
154 <xsl:choose>
155 <xsl:when test="self::xref">
156 <xsl:choose>
157 <xsl:when test="contains(concat(' ',normalize-space($list),' '),
158 concat(' ',@linkend,' '))">
159 <xsl:choose>
160 <xsl:when test="@linkend='x-window-system' or @linkend='xorg7'">
161 <xref linkend="xorg7-server"/>
162 </xsl:when>
163 <xsl:when test="@linkend='server-mail'">
164 <xref linkend="{$MTA}"/>
165 </xsl:when>
166 <xsl:otherwise>
167 <xsl:copy-of select="."/>
168 </xsl:otherwise>
169 </xsl:choose>
170 </xsl:when>
171 <xsl:otherwise>
172 <xsl:choose>
173 <xsl:when test="@linkend='bootscripts' or
174 @linkend='systemd-units'">
175 <xsl:copy-of select="."/>
176 </xsl:when>
177 <xsl:otherwise>
178 <xsl:value-of select="@linkend"/> (in full book)
179 </xsl:otherwise>
180 </xsl:choose>
181 </xsl:otherwise>
182 </xsl:choose>
183 </xsl:when>
184 <xsl:when test="@id">
185 <xsl:element name="{name()}">
186 <xsl:for-each select="attribute::*">
187 <xsl:attribute name="{name()}">
188 <xsl:value-of select="."/>
189 <xsl:if test="name() = 'id'">-pass1</xsl:if>
190 </xsl:attribute>
191 </xsl:for-each>
192 <xsl:apply-templates mode="pass1"/>
193 </xsl:element>
194 </xsl:when>
195 <xsl:when test=".//xref | .//@id">
196 <xsl:element name="{name()}">
197 <xsl:for-each select="attribute::*">
198 <xsl:attribute name="{name()}">
199 <xsl:value-of select="."/>
200 </xsl:attribute>
201 </xsl:for-each>
202 <xsl:apply-templates mode="pass1"/>
203 </xsl:element>
204 </xsl:when>
205 <xsl:otherwise>
206 <xsl:copy-of select="."/>
207 </xsl:otherwise>
208 </xsl:choose>
209 </xsl:template>
210
211 <xsl:template match="*" mode="pass1-sect2">
212 <xsl:choose>
213 <xsl:when test="self::sect2">
214 <xsl:element name="sect1">
215 <xsl:attribute name="id"><xsl:value-of select="@id"/>-pass1</xsl:attribute>
216 <xsl:attribute name="xreflabel"><xsl:value-of select="@xreflabel"/></xsl:attribute>
217 <xsl:processing-instruction name="dbhtml">filename="<xsl:value-of
218 select="@id"/>-pass1.html"</xsl:processing-instruction>
219 <xsl:apply-templates mode="pass1-sect2"/>
220 </xsl:element>
221 </xsl:when>
222 <xsl:when test="self::sect3">
223 <xsl:element name="sect2">
224 <xsl:attribute name="role">
225 <xsl:value-of select="@role"/>
226 </xsl:attribute>
227 <xsl:apply-templates mode="pass1-sect2"/>
228 </xsl:element>
229 </xsl:when>
230 <xsl:when test="self::bridgehead">
231 <xsl:element name="bridgehead">
232 <xsl:attribute name="renderas">
233 <xsl:if test="@renderas='sect4'">sect3</xsl:if>
234 <xsl:if test="@renderas='sect5'">sect4</xsl:if>
235 </xsl:attribute>
236 <xsl:value-of select='.'/>
237 </xsl:element>
238 </xsl:when>
239 <xsl:when test="self::xref">
240 <xsl:choose>
241 <xsl:when test="contains(concat(' ',normalize-space($list),' '),
242 concat(' ',@linkend,' '))">
243 <xsl:choose>
244 <xsl:when test="@linkend='x-window-system' or @linkend='xorg7'">
245 <xref linkend="xorg7-server"/>
246 </xsl:when>
247 <xsl:when test="@linkend='server-mail'">
248 <xref linkend="{$MTA}"/>
249 </xsl:when>
250 <xsl:otherwise>
251 <xsl:copy-of select="."/>
252 </xsl:otherwise>
253 </xsl:choose>
254 </xsl:when>
255 <xsl:otherwise>
256 <xsl:choose>
257 <xsl:when test="@linkend='bootscripts' or
258 @linkend='systemd-units'">
259 <xsl:copy-of select="."/>
260 </xsl:when>
261 <xsl:otherwise>
262 <xsl:value-of select="@linkend"/> (in full book)
263 </xsl:otherwise>
264 </xsl:choose>
265 </xsl:otherwise>
266 </xsl:choose>
267 </xsl:when>
268 <xsl:when test="@id">
269 <xsl:element name="{name()}">
270 <xsl:for-each select="attribute::*">
271 <xsl:attribute name="{name()}">
272 <xsl:value-of select="."/>
273 <xsl:if test="name() = 'id'">-pass1</xsl:if>
274 </xsl:attribute>
275 </xsl:for-each>
276 <xsl:apply-templates mode="pass1-sect2"/>
277 </xsl:element>
278 </xsl:when>
279 <xsl:when test=".//xref | .//@id">
280 <xsl:element name="{name()}">
281 <xsl:for-each select="attribute::*">
282 <xsl:attribute name="{name()}">
283 <xsl:value-of select="."/>
284 </xsl:attribute>
285 </xsl:for-each>
286 <xsl:apply-templates mode="pass1-sect2"/>
287 </xsl:element>
288 </xsl:when>
289 <xsl:otherwise>
290 <xsl:copy-of select="."/>
291 </xsl:otherwise>
292 </xsl:choose>
293 </xsl:template>
294
295 <xsl:template match="processing-instruction()" mode="pass1">
296 <xsl:variable name="pi-full" select="string()"/>
297 <xsl:variable name="pi-value"
298 select="substring-after($pi-full,'filename=')"/>
299 <xsl:variable name="filename"
300 select="substring-before(substring($pi-value,2),'.html')"/>
301 <xsl:processing-instruction name="dbhtml">filename="<xsl:copy-of
302 select="$filename"/>-pass1.html"</xsl:processing-instruction>
303 </xsl:template>
304
305 <xsl:template match="processing-instruction()" mode="sect1">
306 <xsl:copy-of select="."/>
307 </xsl:template>
308
309<!-- Any node which has no xref descendant is copied verbatim. If there
310 is an xref descendant, output the node and recurse. -->
311 <xsl:template match="*" mode="sect1">
312 <xsl:choose>
313 <xsl:when test="self::xref">
314 <xsl:choose>
315 <xsl:when test="contains(concat(' ',normalize-space($list),' '),
316 concat(' ',@linkend,' '))">
317 <xsl:choose>
318 <xsl:when test="@linkend='x-window-system' or @linkend='xorg7'">
319 <xref linkend="xorg7-server"/>
320 </xsl:when>
321 <xsl:when test="@linkend='server-mail'">
322 <xref linkend="{$MTA}"/>
323 </xsl:when>
324 <xsl:otherwise>
325 <xsl:copy-of select="."/>
326 </xsl:otherwise>
327 </xsl:choose>
328 </xsl:when>
329 <xsl:otherwise>
330 <xsl:choose>
331 <xsl:when test="@linkend='bootscripts' or
332 @linkend='systemd-units'">
333 <xsl:copy-of select="."/>
334 </xsl:when>
335 <xsl:otherwise>
336 <xsl:value-of select="@linkend"/> (in full book)
337 </xsl:otherwise>
338 </xsl:choose>
339 </xsl:otherwise>
340 </xsl:choose>
341 </xsl:when>
342 <xsl:when test=".//xref">
343 <xsl:element name="{name()}">
344 <xsl:for-each select="attribute::*">
345 <xsl:attribute name="{name()}">
346 <xsl:value-of select="."/>
347 </xsl:attribute>
348 </xsl:for-each>
349 <xsl:apply-templates mode="sect1"/>
350 </xsl:element>
351 </xsl:when>
352 <xsl:otherwise>
353 <xsl:copy-of select="."/>
354 </xsl:otherwise>
355 </xsl:choose>
356 </xsl:template>
357
358<!-- Python modules and DBus bindings -->
359 <xsl:template match="sect2">
360 <xsl:apply-templates select='.' mode="sect2"/>
361 </xsl:template>
362
363 <xsl:template match="*" mode="sect2">
364 <xsl:choose>
365 <xsl:when test="self::sect2">
366 <xsl:element name="sect1">
367 <xsl:attribute name="id"><xsl:value-of select="@id"/></xsl:attribute>
368 <xsl:attribute name="xreflabel"><xsl:value-of select="@xreflabel"/></xsl:attribute>
369 <xsl:processing-instruction name="dbhtml">filename="<xsl:value-of
370 select="@id"/>.html"</xsl:processing-instruction>
371 <xsl:apply-templates mode="sect2"/>
372 </xsl:element>
373 </xsl:when>
374 <xsl:when test="self::sect3">
375 <xsl:element name="sect2">
376 <xsl:attribute name="role">
377 <xsl:value-of select="@role"/>
378 </xsl:attribute>
379 <xsl:apply-templates mode="sect2"/>
380 </xsl:element>
381 </xsl:when>
382 <xsl:when test="self::bridgehead">
383 <xsl:element name="bridgehead">
384 <xsl:attribute name="renderas">
385 <xsl:if test="@renderas='sect4'">sect3</xsl:if>
386 <xsl:if test="@renderas='sect5'">sect4</xsl:if>
387 </xsl:attribute>
388 <xsl:value-of select='.'/>
389 </xsl:element>
390 </xsl:when>
391 <xsl:when test="self::xref">
392 <xsl:choose>
393 <xsl:when test="contains(concat(' ',normalize-space($list),' '),
394 concat(' ',@linkend,' '))">
395 <xsl:choose>
396 <xsl:when test="@linkend='x-window-system' or @linkend='xorg7'">
397 <xref linkend="xorg7-server"/>
398 </xsl:when>
399 <xsl:when test="@linkend='server-mail'">
400 <xref linkend="{$MTA}"/>
401 </xsl:when>
402 <xsl:otherwise>
403 <xsl:copy-of select="."/>
404 </xsl:otherwise>
405 </xsl:choose>
406 </xsl:when>
407 <xsl:otherwise>
408 <xsl:value-of select="@linkend"/> (in full book)
409 </xsl:otherwise>
410 </xsl:choose>
411 </xsl:when>
412 <xsl:when test=".//xref">
413 <xsl:element name="{name()}">
414 <xsl:for-each select="attribute::*">
415 <xsl:attribute name="{name()}">
416 <xsl:value-of select="."/>
417 </xsl:attribute>
418 </xsl:for-each>
419 <xsl:apply-templates mode="sect2"/>
420 </xsl:element>
421 </xsl:when>
422 <xsl:otherwise>
423 <xsl:copy-of select="."/>
424 </xsl:otherwise>
425 </xsl:choose>
426 </xsl:template>
427
428<!-- Perl modules : transform them to minimal sect1. Use a template
429 for installation instructions -->
430 <xsl:template match="bridgehead">
431 <xsl:if test="ancestor::sect1[@id='perl-modules']">
432 <xsl:element name="sect1">
433 <xsl:attribute name="id"><xsl:value-of select="./@id"/></xsl:attribute>
434 <xsl:attribute name="xreflabel"><xsl:value-of select="./@xreflabel"/></xsl:attribute>
435 <xsl:processing-instruction name="dbhtml">
436 filename="<xsl:value-of select="@id"/>.html"</xsl:processing-instruction>
437 <title><xsl:value-of select="./@xreflabel"/></title>
438 <sect2 role="package">
439 <title>Introduction to <xsl:value-of select="@id"/></title>
440 <bridgehead renderas="sect3">Package Information</bridgehead>
441 <itemizedlist spacing="compact">
442 <listitem>
443 <para>Download (HTTP): <xsl:copy-of select="./following-sibling::itemizedlist[1]/listitem/para/ulink"/></para>
444 </listitem>
445 <listitem>
446 <para>Download (FTP): <ulink url=" "/></para>
447 </listitem>
448 </itemizedlist>
449 </sect2>
450 <xsl:choose>
451 <xsl:when test="following-sibling::itemizedlist[1]//xref[@linkend='perl-standard-install'] | following-sibling::itemizedlist[1]/preceding-sibling::para//xref[@linkend='perl-standard-install']">
452 <xsl:apply-templates mode="perl-install" select="id('perl-standard-install')"/>
453 </xsl:when>
454 <xsl:otherwise>
455 <sect2 role="installation">
456 <title>Installation of <xsl:value-of select="@xreflabel"/></title>
457 <para>Run the following commands:</para>
458 <for-each select="following-sibling::bridgehead/preceding-sibling::screen[not(@role)]">
459 <xsl:copy-of select="."/>
460 </for-each>
461 <para>Now, as the <systemitem class="username">root</systemitem> user:</para>
462 <for-each select="following-sibling::bridgehead/preceding-sibling::screen[@role='root']">
463 <xsl:copy-of select="."/>
464 </for-each>
465 </sect2>
466 </xsl:otherwise>
467 </xsl:choose>
468 </xsl:element>
469 </xsl:if>
470 </xsl:template>
471
472<!-- The case of depdendencies of perl modules. Same treatment
473 as for perl modules. Just easier because always perl standard -->
474 <xsl:template match="para">
475 <xsl:element name="sect1">
476 <xsl:attribute name="id"><xsl:value-of select="./@id"/></xsl:attribute>
477 <xsl:attribute name="xreflabel"><xsl:value-of select="./@xreflabel"/></xsl:attribute>
478 <xsl:processing-instruction name="dbhtml">filename="<xsl:value-of
479 select="@id"/>.html"</xsl:processing-instruction>
480 <title><xsl:value-of select="./@xreflabel"/></title>
481 <sect2 role="package">
482 <title>Introduction to <xsl:value-of select="@id"/></title>
483 <bridgehead renderas="sect3">Package Information</bridgehead>
484 <itemizedlist spacing="compact">
485 <listitem>
486 <para>Download (HTTP): <xsl:copy-of select="./ulink"/></para>
487 </listitem>
488 <listitem>
489 <para>Download (FTP): <ulink url=" "/></para>
490 </listitem>
491 </itemizedlist>
492 </sect2>
493 <xsl:apply-templates mode="perl-install" select="id('perl-standard-install')"/>
494 </xsl:element>
495 </xsl:template>
496
497<!-- copy of the perl standard installation instructions:
498 suppress id (otherwise not unique) and note (which we
499 do not want to apply -->
500 <xsl:template match="sect2" mode="perl-install">
501 <sect2 role="installation">
502 <xsl:for-each select="./*">
503 <xsl:if test="not(self::note)">
504 <xsl:copy-of select="."/>
505 </xsl:if>
506 </xsl:for-each>
507 </sect2>
508 </xsl:template>
509
510<!-- we have got an xorg package. We are at the installation page
511 but now we need to make an autonomous page from the global
512 one -->
513 <xsl:template match="sect1" mode="compound">
514 <xsl:param name="package"/>
515 <xsl:variable name="tarball">
516 <xsl:call-template name="tarball">
517 <xsl:with-param name="package" select="concat(' ',$package,'-')"/>
518 <xsl:with-param name="cat-md5"
519 select="string(.//userinput[starts-with(string(),'cat ')])"/>
520 </xsl:call-template>
521 </xsl:variable>
522 <!-- Unfortunately, there are packages in kf5 and plasma5 that
523 starts in the same way: for example kwallet in kf5
524 and kwallet-pam in plasma. So we may arrive here with
525 package=kwallet and tarball=kwallet-pam-(version).tar.xz.
526 We should not continue in this case. For checking, transform
527 digits into X, and check that package-X occurs in tarball. We
528 have to translate package too, since it may contain digits.-->
529 <xsl:if test=
530 "contains(translate($tarball,'0123456789','XXXXXXXXXX'),
531 concat(translate($package,'0123456789','XXXXXXXXXX'),'-X'))">
532 <xsl:variable name="md5sum">
533 <xsl:call-template name="md5sum">
534 <xsl:with-param name="package" select="concat(' ',$package,'-')"/>
535 <xsl:with-param name="cat-md5"
536 select=".//userinput[starts-with(string(),'cat ')]"/>
537 </xsl:call-template>
538 </xsl:variable>
539 <xsl:variable name="download-dir">
540 <xsl:call-template name="download-dir">
541 <xsl:with-param name="package" select="concat(' ',$package,'-')"/>
542 <xsl:with-param name="cat-md5"
543 select=".//userinput[starts-with(string(),'cat ')]"/>
544 </xsl:call-template>
545 </xsl:variable>
546 <xsl:variable name="install-instructions">
547 <xsl:call-template name="inst-instr">
548 <xsl:with-param name="inst-instr"
549 select=
550 "substring-after(
551 substring-after(.//userinput[starts-with(string(),'for ') or
552 starts-with(string(),'while ')],
553 'pushd'),
554 '&#xA;')"/>
555 <xsl:with-param name="package" select="$package"/>
556 </xsl:call-template>
557 </xsl:variable>
558 <xsl:element name="sect1">
559 <xsl:attribute name="id">
560 <xsl:value-of select="$package"/>
561 </xsl:attribute>
562 <xsl:processing-instruction name="dbhtml">
563 filename="<xsl:value-of select='$package'/>.html"
564 </xsl:processing-instruction>
565 <title><xsl:value-of select="$package"/></title>
566 <sect2 role="package">
567 <title>Introduction to <xsl:value-of select="$package"/></title>
568 <bridgehead renderas="sect3">Package Information</bridgehead>
569 <itemizedlist spacing="compact">
570 <listitem>
571 <para>Download (HTTP): <xsl:element name="ulink">
572 <xsl:attribute name="url">
573 <xsl:value-of
574 select=".//para[contains(string(),'(HTTP)')]/ulink/@url"/>
575 <xsl:value-of select="$download-dir"/>
576 <!-- $download-dir contains the trailing / for xorg,
577 but not for KDE... -->
578 <xsl:if test="contains(@id,'frameworks') or
579 contains(@id,'plasma5')">
580 <xsl:text>/</xsl:text>
581 </xsl:if>
582 <!-- Some kf5 packages are in a subdirectory -->
583 <xsl:if test="$package='khtml' or
584 $package='kdelibs4support' or
585 $package='kdesignerplugin' or
586 $package='kdewebkit' or
587 $package='kjs' or
588 $package='kjsembed' or
589 $package='kmediaplayer' or
590 $package='kross' or
591 $package='kxmlrpcclient'">
592 <xsl:text>portingAids/</xsl:text>
593 </xsl:if>
594 <xsl:value-of select="$tarball"/>
595 </xsl:attribute>
596 </xsl:element>
597 </para>
598 </listitem>
599 <!-- don't use FTP, although they are available for xorg -->
600 <listitem>
601 <para>Download (FTP): <ulink url=" "/>
602 </para>
603 </listitem>
604 <listitem>
605 <para>
606 Download MD5 sum: <xsl:value-of select="$md5sum"/>
607 </para>
608 </listitem>
609 </itemizedlist>
610 <!-- If there is an additional download, we need to output that -->
611 <xsl:if test=".//bridgehead[contains(string(),'Additional')]">
612 <xsl:copy-of
613 select=".//bridgehead[contains(string(),'Additional')]"/>
614 <xsl:copy-of
615 select=".//bridgehead[contains(string(),'Additional')]
616 /following-sibling::itemizedlist[1]"/>
617 </xsl:if>
618 </sect2>
619 <sect2 role="installation">
620 <title>Installation of <xsl:value-of select="$package"/></title>
621
622 <para>
623 Install <application><xsl:value-of select="$package"/></application>
624 by running the following commands:
625 </para>
626 <!-- packagedir is used in xorg lib instructions -->
627 <screen><userinput>packagedir=<xsl:value-of
628 select="substring-before($tarball,'.tar.')"/>
629 <!-- name is used in kf5 instructions -->
630 <xsl:text>
631name=$(echo $packagedir | sed 's/-[[:digit:]].*//')
632</xsl:text>
633 <xsl:value-of select="substring-before($install-instructions,
634 'as_root')"/>
635 </userinput></screen>
636
637 <para>
638 Now as the <systemitem class="username">root</systemitem> user:
639 </para>
640 <screen role='root'>
641 <userinput><xsl:value-of select="substring-after(
642 $install-instructions,
643 'as_root')"/>
644 </userinput>
645 </screen>
646 </sect2>
647 </xsl:element><!-- sect1 -->
648 </xsl:if>
649
650 </xsl:template>
651
652<!-- get the tarball name from the text that comes from the .md5 file -->
653 <xsl:template name="tarball">
654 <!-- $package must start with a space, and finish with a "-", to be
655 sure to match exactly the package. Note that if we have two
656 packages named e.g. "pkg1" and "pkg1-add", the second one may be
657 matched by " pkg1-". So this only works if "pkg1" comes before
658 "pkg1-add" in the md5 file. Presently this is the case in the book...
659 -->
660 <xsl:param name="package"/>
661 <xsl:param name="cat-md5"/>
662 <xsl:choose>
663 <xsl:when test="contains(substring-before($cat-md5,$package),'&#xA;')">
664 <xsl:call-template name="tarball">
665 <xsl:with-param name="package" select="$package"/>
666 <xsl:with-param name="cat-md5"
667 select="substring-after($cat-md5,'&#xA;')"/>
668 </xsl:call-template>
669 </xsl:when>
670 <xsl:when test="contains(substring-before($cat-md5,$package),' ')">
671 <xsl:call-template name="tarball">
672 <xsl:with-param name="package" select="$package"/>
673 <xsl:with-param name="cat-md5"
674 select="substring-after($cat-md5,' ')"/>
675 </xsl:call-template>
676 </xsl:when>
677 <xsl:otherwise>
678 <xsl:copy-of select="substring-after(
679 substring-before($cat-md5,'&#xA;'),' ')"/>
680 </xsl:otherwise>
681 </xsl:choose>
682 </xsl:template>
683<!-- get the download dirname from the text that comes from the .md5 file -->
684 <xsl:template name="download-dir">
685 <xsl:param name="package"/>
686 <xsl:param name="cat-md5"/>
687 <xsl:choose>
688 <xsl:when test="not(@id='xorg7-legacy')">
689 <xsl:copy-of select="''"/>
690 </xsl:when>
691 <xsl:when test="contains(substring-before($cat-md5,$package),'&#xA;')">
692 <xsl:call-template name="download-dir">
693 <xsl:with-param name="package" select="$package"/>
694 <xsl:with-param name="cat-md5"
695 select="substring-after($cat-md5,'&#xA;')"/>
696 </xsl:call-template>
697 </xsl:when>
698 <xsl:when test="contains(substring-before($cat-md5,$package),' ')">
699 <xsl:call-template name="download-dir">
700 <xsl:with-param name="package" select="$package"/>
701 <xsl:with-param name="cat-md5"
702 select="substring-after($cat-md5,' ')"/>
703 </xsl:call-template>
704 </xsl:when>
705 <xsl:otherwise>
706 <xsl:copy-of select="substring-before($cat-md5,' ')"/>
707 </xsl:otherwise>
708 </xsl:choose>
709 </xsl:template>
710<!-- same for md5sum -->
711 <xsl:template name="md5sum">
712 <xsl:param name="package"/>
713 <xsl:param name="cat-md5"/>
714 <xsl:choose>
715 <xsl:when test="contains(substring-before($cat-md5,$package),'&#xA;')">
716 <xsl:call-template name="md5sum">
717 <xsl:with-param name="package" select="$package"/>
718 <xsl:with-param name="cat-md5"
719 select="substring-after($cat-md5,'&#xA;')"/>
720 </xsl:call-template>
721 </xsl:when>
722 <xsl:otherwise>
723 <xsl:copy-of select="substring-before($cat-md5,' ')"/>
724 </xsl:otherwise>
725 </xsl:choose>
726 </xsl:template>
727
728 <xsl:template name="inst-instr">
729 <!-- This template is necessary because of the "libpciaccess" case in Xorg
730 libraries and the "kapidox" case in kf5:
731 Normally, the general instructions extract the package and change
732 to the extracted dir for running the installation instructions.
733 When installing a sub-package of a compound package, the installation
734 instructions to be run are located between a pushd and a popd,
735 *except* for Xorg libraries and kf5, where a popd occurs inside a
736 case for libpciaccess and kapidox...
737 So we call this template with a "inst-instr" string that contains
738 everything after the pushd.-->
739 <xsl:param name="inst-instr"/>
740 <xsl:param name="package"/>
741 <xsl:choose>
742 <!-- first the cases where there are two "popd"-->
743 <xsl:when test="contains(substring-after($inst-instr,'popd'),'popd')">
744 <xsl:choose>
745 <xsl:when test="$package='kapidox'">
746 <!-- only the instructions inside the "case" and before popd -->
747 <xsl:copy-of select="substring-after(substring-before($inst-instr,'popd'),'kapidox)')"/>
748 </xsl:when>
749 <xsl:when test="$package='libpciaccess'">
750 <!-- only the instructions inside the "case" and before popd -->
751 <xsl:copy-of select="substring-after(substring-before($inst-instr,'popd'),'libpciaccess* )')"/>
752 </xsl:when>
753 <xsl:otherwise>
754 <!-- We first copy what is before the first "as_root", then what is
755 after the first "popd", by calling the template again. The
756 reason for excluding "as_root" is that the output template takes
757 special action when it sees "as_root", which generates bogus code
758 if there are several of those...-->
759 <xsl:copy-of select="substring-before($inst-instr,'as_root')"/>
760 <xsl:call-template name="inst-instr">
761 <xsl:with-param
762 name="inst-instr"
763 select="substring-after($inst-instr,'popd')"/>
764 </xsl:call-template>
765 </xsl:otherwise>
766 </xsl:choose>
767 </xsl:when>
768 <xsl:otherwise>
769 <!-- normal case: everything that is before popd -->
770 <xsl:copy-of select="substring-before($inst-instr,'popd')"/>
771 </xsl:otherwise>
772 </xsl:choose>
773 </xsl:template>
774
775 <xsl:template match="sect1" mode="plasma-post-install">
776 <xsl:variable name="package" select="'plasma-post-install'"/>
777 <xsl:element name="sect1">
778 <xsl:attribute name="id">
779 <xsl:value-of select="$package"/>
780 </xsl:attribute>
781 <xsl:processing-instruction name="dbhtml">
782 filename="<xsl:value-of select='$package'/>.html"
783 </xsl:processing-instruction>
784 <title><xsl:value-of select="$package"/></title>
785 <sect2 role="installation">
786 <title>Installation of <xsl:value-of select="$package"/></title>
787
788 <para>
789 Install <application><xsl:value-of select="$package"/></application>
790 by running the following commands:
791 </para>
792 <screen role="root">
793 <userinput>
794 <xsl:call-template name="plasma-sessions">
795 <xsl:with-param
796 name="p-sessions-text"
797 select="string(.//userinput[contains(text(),'xsessions')])"/>
798 </xsl:call-template>
799 </userinput>
800 </screen>
801 <xsl:copy-of select=".//screen[@role='root']"/>
802 </sect2>
803 </xsl:element><!-- sect1 -->
804 </xsl:template>
805
806 <xsl:template name="plasma-sessions">
807 <xsl:param name="p-sessions-text"/>
808 <xsl:choose>
809 <xsl:when test="string-length($p-sessions-text)=0"/>
810 <xsl:when test="contains($p-sessions-text,'as_root')">
811 <xsl:call-template name="plasma-sessions">
812 <xsl:with-param
813 name="p-sessions-text"
814 select="substring-before($p-sessions-text,'as_root')"/>
815 </xsl:call-template>
816 <xsl:call-template name="plasma-sessions">
817 <xsl:with-param
818 name="p-sessions-text"
819 select="substring-after($p-sessions-text,'as_root ')"/>
820 </xsl:call-template>
821 </xsl:when>
822 <xsl:otherwise>
823 <xsl:copy-of select="$p-sessions-text"/>
824 </xsl:otherwise>
825 </xsl:choose>
826 </xsl:template>
827
828</xsl:stylesheet>
Note: See TracBrowser for help on using the repository browser.