source: BLFS/xsl/make_book.xsl

trunk
Last change on this file was 695a921, checked in by Pierre Labastie <pierre.labastie@…>, 10 months ago

Adapt to new book layout in Xorg libraries

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