source: BLFS/xsl/make_book.xsl@ faa6594

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

Add comments after adding kf5 and plasma to special

  • Property mode set to 100644
File size: 27.5 KB
RevLine 
[e576789]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'"/>
[91b7b5f]8 <xsl:param name="lfsbook" select="'lfs-full.xml'"/>
[e576789]9
[70d73d1]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
[e576789]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
[91b7b5f]27 <xsl:include href="lfs_make_book.xsl"/>
28
[e576789]29 <xsl:template match="/">
30 <book>
31 <xsl:copy-of select="/book/bookinfo"/>
32 <preface>
33 <?dbhtml filename="preface.html"?>
34 <title>Preface</title>
[70d73d1]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>
[e576789]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),
[0cd09c6]60 sect2 (python/perl modules/dependencies )
[e576789]61 The templates after this one treat each of those cases.
[faa6594]62 However, some items are sub-packages of compound packages (xorg7-*,
63 kf5, plasma), and not id.
[e576789]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.
[0cd09c6]67 Hopefully, none of those id's are sect{1,2}...-->
[e576789]68 <xsl:template name="apply-list">
69 <xsl:param name="list" select="''"/>
70 <xsl:if test="string-length($list) &gt; 0">
71 <xsl:choose>
[faa6594]72 <!-- iterate if there are several packages in list -->
[e576789]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>
[faa6594]83 <!-- From now on, $list contains only one package -->
84 <!-- If it is a group, do nothing -->
[2140f22]85 <xsl:when test="contains($list,'groupxx')"/>
[e576789]86 <xsl:otherwise>
[91b7b5f]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>
[e576789]93 <xsl:choose>
[91b7b5f]94 <xsl:when test="$is-lfs='true'">
[faa6594]95 <!-- LFS package -->
[91b7b5f]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>
[2140f22]105 <xsl:when test="contains(concat($list,' '),'-pass1 ')">
[0cd09c6]106<!-- We need to do it for both sect1 and sect2, because of libva -->
[2140f22]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>
[0a0b609]113 <xsl:if test="id($real-id)[self::sect2]">
114 <xsl:apply-templates select="id($real-id)" mode="pass1-sect2"/>
115 </xsl:if>
[2140f22]116 </xsl:when>
[faa6594]117 <xsl:when test="not(id($list)[self::sect1 or self::sect2])">
118 <!-- This is a sub-package: parse the corresponding compound
119 package-->
[e576789]120 <xsl:apply-templates
[0cd09c6]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,'-'))]]"
[faa6594]126 mode="compound">
[e576789]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
[2140f22]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
[0a0b609]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
[2140f22]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
[e576789]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>
[70d73d1]323 <xsl:when test="@linkend='bootscripts' or
[2e1c1c3]324 @linkend='systemd-units'">
[e576789]325 <xsl:copy-of select="."/>
[2e1c1c3]326 </xsl:when>
[e576789]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">
[ca37fee]423 <xsl:if test="ancestor::sect1[@id='perl-modules']">
[e576789]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>
[ca37fee]461 </xsl:if>
[e576789]462 </xsl:template>
463
464<!-- The case of depdendencies of perl modules. Same treatment
[2e1c1c3]465 as for perl modules. Just easier because always perl standard -->
[e576789]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 -->
[faa6594]505 <xsl:template match="sect1" mode="compound">
[e576789]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 <xsl:variable name="md5sum">
515 <xsl:call-template name="md5sum">
516 <xsl:with-param name="package" select="concat(' ',$package,'-')"/>
517 <xsl:with-param name="cat-md5"
518 select=".//userinput[starts-with(string(),'cat ')]"/>
519 </xsl:call-template>
520 </xsl:variable>
[342c862]521 <xsl:variable name="download-dir">
522 <xsl:call-template name="download-dir">
523 <xsl:with-param name="package" select="concat(' ',$package,'-')"/>
524 <xsl:with-param name="cat-md5"
525 select=".//userinput[starts-with(string(),'cat ')]"/>
526 </xsl:call-template>
527 </xsl:variable>
[e576789]528 <xsl:variable name="install-instructions">
529 <xsl:call-template name="inst-instr">
530 <xsl:with-param name="inst-instr"
[0cd09c6]531 select=
532 "substring-after(
533 substring-after(.//userinput[starts-with(string(),'for ') or
534 starts-with(string(),'while ')],
535 'pushd'),
536 '&#xA;')"/>
537 <xsl:with-param name="package" select="$package"/>
[e576789]538 </xsl:call-template>
539 </xsl:variable>
540 <xsl:element name="sect1">
541 <xsl:attribute name="id"><xsl:value-of select="$package"/></xsl:attribute>
542 <xsl:processing-instruction name="dbhtml">
543 filename="<xsl:value-of select='$package'/>.html"
544 </xsl:processing-instruction>
545 <title><xsl:value-of select="$package"/></title>
546 <sect2 role="package">
547 <title>Introduction to <xsl:value-of select="$package"/></title>
548 <bridgehead renderas="sect3">Package Information</bridgehead>
549 <itemizedlist spacing="compact">
550 <listitem>
551 <para>Download (HTTP): <xsl:element name="ulink">
552 <xsl:attribute name="url">
553 <xsl:value-of
554 select=".//para[contains(string(),'(HTTP)')]/ulink/@url"/>
[342c862]555 <xsl:value-of select="$download-dir"/>
[0cd09c6]556 <xsl:if test="contains(@id,'frameworks') or
557 contains(@id,'plasma5')">
558 <xsl:text>/</xsl:text>
559 </xsl:if>
[e576789]560 <xsl:value-of select="$tarball"/>
561 </xsl:attribute>
562 </xsl:element>
563 </para>
564 </listitem>
565 <listitem>
[0cd09c6]566 <para>Download (FTP): <ulink url=" "/>
[e576789]567 </para>
568 </listitem>
569 <listitem>
570 <para>
571 Download MD5 sum: <xsl:value-of select="$md5sum"/>
572 </para>
573 </listitem>
574 </itemizedlist>
[642722f]575 <!-- If there is an additional download, we need to output that -->
576 <xsl:if test=".//bridgehead[contains(string(),'Additional')]">
577 <xsl:copy-of
578 select=".//bridgehead[contains(string(),'Additional')]"/>
579 <xsl:copy-of
580 select=".//bridgehead[contains(string(),'Additional')]
581 /following-sibling::itemizedlist[1]"/>
582 </xsl:if>
[e576789]583 </sect2>
584 <sect2 role="installation">
585 <title>Installation of <xsl:value-of select="$package"/></title>
586
587 <para>
588 Install <application><xsl:value-of select="$package"/></application>
589 by running the following commands:
590 </para>
591
592 <screen><userinput>packagedir=<xsl:value-of
[794f94f]593 select="substring-before($tarball,'.tar.')"/>
[0cd09c6]594 <xsl:text>
595 name=$(echo $pkg | sed 's/-[[:digit:]].*//')
596 </xsl:text>
[e576789]597 <xsl:value-of select="substring-before($install-instructions,
598 'as_root')"/>
599 </userinput></screen>
600
601 <para>
602 Now as the <systemitem class="username">root</systemitem> user:
603 </para>
604 <screen role='root'>
605 <userinput><xsl:value-of select="substring-after(
606 $install-instructions,
607 'as_root')"/>
608 </userinput>
609 </screen>
610 </sect2>
611 </xsl:element><!-- sect1 -->
612
613 </xsl:template>
614
615<!-- get the tarball name from the text that comes from the .md5 file -->
616 <xsl:template name="tarball">
[faa6594]617 <!-- $package must start with a space, and finish with a "-", to be
618 sure to match exactly the package. Note that if we have two
619 packages named e.g. "pkg1" and "pkg1-add", the second one may be
620 matched by " pkg1-". So this only works if "pkg1" comes before
621 "pkg1-add" in the md5 file. Presently this is the case in the book...
622 -->
[e576789]623 <xsl:param name="package"/>
624 <xsl:param name="cat-md5"/>
625 <xsl:choose>
626 <xsl:when test="contains(substring-before($cat-md5,$package),'&#xA;')">
627 <xsl:call-template name="tarball">
628 <xsl:with-param name="package" select="$package"/>
629 <xsl:with-param name="cat-md5"
630 select="substring-after($cat-md5,'&#xA;')"/>
631 </xsl:call-template>
632 </xsl:when>
[342c862]633 <xsl:when test="contains(substring-before($cat-md5,$package),' ')">
634 <xsl:call-template name="tarball">
635 <xsl:with-param name="package" select="$package"/>
636 <xsl:with-param name="cat-md5"
637 select="substring-after($cat-md5,' ')"/>
638 </xsl:call-template>
639 </xsl:when>
[e576789]640 <xsl:otherwise>
641 <xsl:copy-of select="substring-after(
[342c862]642 substring-before($cat-md5,'&#xA;'),' ')"/>
643 </xsl:otherwise>
644 </xsl:choose>
645 </xsl:template>
646<!-- get the download dirname from the text that comes from the .md5 file -->
647 <xsl:template name="download-dir">
648 <xsl:param name="package"/>
649 <xsl:param name="cat-md5"/>
650 <xsl:choose>
651 <xsl:when test="not(@id='xorg7-legacy')">
652 <xsl:copy-of select="''"/>
653 </xsl:when>
654 <xsl:when test="contains(substring-before($cat-md5,$package),'&#xA;')">
655 <xsl:call-template name="download-dir">
656 <xsl:with-param name="package" select="$package"/>
657 <xsl:with-param name="cat-md5"
658 select="substring-after($cat-md5,'&#xA;')"/>
659 </xsl:call-template>
660 </xsl:when>
661 <xsl:when test="contains(substring-before($cat-md5,$package),' ')">
662 <xsl:call-template name="download-dir">
663 <xsl:with-param name="package" select="$package"/>
664 <xsl:with-param name="cat-md5"
665 select="substring-after($cat-md5,' ')"/>
666 </xsl:call-template>
667 </xsl:when>
668 <xsl:otherwise>
669 <xsl:copy-of select="substring-before($cat-md5,' ')"/>
[e576789]670 </xsl:otherwise>
671 </xsl:choose>
672 </xsl:template>
673<!-- same for md5sum -->
674 <xsl:template name="md5sum">
675 <xsl:param name="package"/>
676 <xsl:param name="cat-md5"/>
677 <xsl:choose>
678 <xsl:when test="contains(substring-before($cat-md5,$package),'&#xA;')">
679 <xsl:call-template name="md5sum">
680 <xsl:with-param name="package" select="$package"/>
681 <xsl:with-param name="cat-md5"
682 select="substring-after($cat-md5,'&#xA;')"/>
683 </xsl:call-template>
684 </xsl:when>
685 <xsl:otherwise>
686 <xsl:copy-of select="substring-before($cat-md5,' ')"/>
687 </xsl:otherwise>
688 </xsl:choose>
689 </xsl:template>
690
691 <xsl:template name="inst-instr">
692 <xsl:param name="inst-instr"/>
[0cd09c6]693 <xsl:param name="package"/>
[e576789]694 <xsl:choose>
[0cd09c6]695 <xsl:when test="contains(substring-after($inst-instr,'popd'),'popd')">
696 <xsl:choose>
697 <xsl:when test="$package='kapidox'">
698 <xsl:copy-of select="substring-after(substring-before($inst-instr,'popd'),'kapidox)')"/>
699 </xsl:when>
700 <xsl:otherwise>
701 <xsl:copy-of select="substring-before($inst-instr,'kapidox)')"/>
702 <xsl:call-template name="inst-instr">
703 <xsl:with-param name="inst-instr"
704 select="substring-after($inst-instr,';;')"/>
705 </xsl:call-template>
706 </xsl:otherwise>
707 </xsl:choose>
[e576789]708 </xsl:when>
709 <xsl:otherwise>
710 <xsl:copy-of select="substring-before($inst-instr,'popd')"/>
711 </xsl:otherwise>
712 </xsl:choose>
713 </xsl:template>
714</xsl:stylesheet>
Note: See TracBrowser for help on using the repository browser.