source: BLFS/xsl/make_book.xsl@ e25788e

ablfs-more legacy trunk
Last change on this file since e25788e was fd4a798, checked in by Pierre Labastie <pierre.labastie@…>, 3 years ago

Remove $Id$ comments, they are useless with git

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