source: BLFS/xsl/make_book.xsl@ 950470d

ablfs-more trunk
Last change on this file since 950470d was bacbb07, checked in by Pierre Labastie <pierre.labastie@…>, 13 months ago

Comments for the inst-instr template

kf5 has one push and to popd in its instructions.
We used to just use what was between push and popd.
But now, we need to only use what is in the
case instruction for one package, and what is
after the esac for all the others.

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