source: BLFS/xsl/scripts.xsl@ 8010030

new_features
Last change on this file since 8010030 was eb8667a, checked in by Pierre Labastie <pierre@…>, 8 years ago

Install units rather than bootscripts when REV=systemd

  • Property mode set to 100644
File size: 22.2 KB
Line 
1<?xml version="1.0"?>
2
3<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
4 xmlns:exsl="http://exslt.org/common"
5 extension-element-prefixes="exsl"
6 version="1.0">
7
8<!-- $Id: scripts.xsl 34 2012-02-21 16:05:09Z labastie $ -->
9
10<!-- XSLT stylesheet to create shell scripts from "linear build" BLFS books. -->
11
12<!-- Check whether the book is sysv or systemd -->
13 <xsl:variable name="rev">
14 <xsl:choose>
15 <xsl:when test="//bookinfo/title/phrase[@revision='systemd']">
16 systemd
17 </xsl:when>
18 <xsl:otherwise>
19 sysv
20 </xsl:otherwise>
21 </xsl:choose>
22 </xsl:variable>
23
24 <!-- Wrap "root" commands inside a wrapper function, allowing
25 "porg style" package management -->
26 <xsl:param name="wrap-install" select="'n'"/>
27
28 <!-- Build as user (y) or as root (n)? -->
29 <xsl:param name="sudo" select="'y'"/>
30
31 <xsl:template match="/">
32 <xsl:apply-templates select="//sect1"/>
33 </xsl:template>
34
35<!--=================== Master chunks code ======================-->
36
37 <xsl:template match="sect1">
38
39 <xsl:if test="@id != 'bootscripts' and @id != 'systemd-units'">
40 <!-- The file names -->
41 <xsl:variable name="filename" select="@id"/>
42
43 <!-- The build order -->
44 <xsl:variable name="position" select="position()"/>
45 <xsl:variable name="order">
46 <xsl:choose>
47 <xsl:when test="string-length($position) = 1">
48 <xsl:text>00</xsl:text>
49 <xsl:value-of select="$position"/>
50 </xsl:when>
51 <xsl:when test="string-length($position) = 2">
52 <xsl:text>0</xsl:text>
53 <xsl:value-of select="$position"/>
54 </xsl:when>
55 <xsl:otherwise>
56 <xsl:value-of select="$position"/>
57 </xsl:otherwise>
58 </xsl:choose>
59 </xsl:variable>
60
61 <!-- Depuration code -->
62 <xsl:message>
63 <xsl:text>SCRIPT is </xsl:text>
64 <xsl:value-of select="concat($order,'-z-',$filename)"/>
65 <xsl:text>&#xA; FTPDIR is </xsl:text>
66 <xsl:value-of select="$filename"/>
67 <xsl:text>&#xA;&#xA;</xsl:text>
68 </xsl:message>
69
70 <!-- Creating the scripts -->
71 <exsl:document href="{$order}-z-{$filename}" method="text">
72 <xsl:text>#!/bin/bash&#xA;set -e&#xA;&#xA;</xsl:text>
73 <xsl:choose>
74 <!-- Package page -->
75 <xsl:when test="sect2[@role='package']">
76 <!-- We build in a subdirectory, whose name may be needed
77 if using package management (see envars.conf), so
78 "export" it -->
79 <xsl:text>export PKG_DIR=</xsl:text>
80 <xsl:value-of select="$filename"/>
81 <xsl:text>&#xA;</xsl:text>
82 <!-- Download code and build commands -->
83 <xsl:apply-templates select="sect2"/>
84 <!-- Clean-up -->
85 <xsl:text>cd $SRC_DIR/$PKG_DIR&#xA;</xsl:text>
86 <!-- In some case, some files in the build tree are owned
87 by root -->
88 <xsl:if test="$sudo='y'">
89 <xsl:text>sudo </xsl:text>
90 </xsl:if>
91 <xsl:text>rm -rf $UNPACKDIR unpacked&#xA;&#xA;</xsl:text>
92 </xsl:when>
93 <!-- Non-package page -->
94 <xsl:otherwise>
95 <xsl:apply-templates select=".//screen"/>
96 </xsl:otherwise>
97 </xsl:choose>
98 <xsl:text>exit</xsl:text>
99 </exsl:document>
100 </xsl:if>
101 </xsl:template>
102
103<!--======================= Sub-sections code =======================-->
104
105 <xsl:template match="sect2">
106 <xsl:choose>
107 <xsl:when test="@role = 'package'">
108 <xsl:text>mkdir -p $SRC_DIR/$PKG_DIR&#xA;</xsl:text>
109 <xsl:text>cd $SRC_DIR/$PKG_DIR&#xA;</xsl:text>
110 <!-- Download information is in bridgehead tags -->
111 <xsl:apply-templates select="bridgehead[@renderas='sect3']"/>
112 <xsl:text>&#xA;</xsl:text>
113 </xsl:when>
114 <xsl:when test="@role = 'qt4-prefix' or @role = 'qt5-prefix'">
115 <xsl:apply-templates select=".//screen"/>
116 </xsl:when>
117 <xsl:when test="@role = 'installation'">
118 <xsl:text>
119find . -maxdepth 1 -mindepth 1 -type d | xargs </xsl:text>
120 <xsl:if test="$sudo='y'">
121 <xsl:text>sudo </xsl:text>
122 </xsl:if>
123 <xsl:text>rm -rf
124case $PACKAGE in
125 *.tar.gz|*.tar.bz2|*.tar.xz|*.tgz|*.tar.lzma)
126 tar -xvf $PACKAGE &gt; unpacked
127 UNPACKDIR=`grep '[^./]\+' unpacked | head -n1 | sed 's@^\./@@;s@/.*@@'`
128 ;;
129 *.tar.lz)
130 bsdtar -xvf $PACKAGE 2&gt; unpacked
131 UNPACKDIR=`head -n1 unpacked | cut -d" " -f2 | sed 's@^\./@@;s@/.*@@'`
132 ;;
133 *.zip)
134 zipinfo -1 $PACKAGE &gt; unpacked
135 UNPACKDIR="$(sed 's@/.*@@' unpacked | uniq )"
136 if test $(wc -w &lt;&lt;&lt; $UNPACKDIR) -eq 1; then
137 unzip $PACKAGE
138 else
139 UNPACKDIR=${PACKAGE%.zip}
140 unzip -d $UNPACKDIR $PACKAGE
141 fi
142 ;;
143 *)
144 UNPACKDIR=$PKG_DIR-build
145 mkdir $UNPACKDIR
146 cp $PACKAGE $UNPACKDIR
147 ;;
148esac
149export UNPACKDIR
150cd $UNPACKDIR&#xA;
151</xsl:text>
152 <xsl:apply-templates select=".//screen | .//para/command"/>
153 <xsl:if test="$sudo = 'y'">
154 <xsl:text>sudo /sbin/</xsl:text>
155 </xsl:if>
156 <xsl:text>ldconfig&#xA;&#xA;</xsl:text>
157 </xsl:when>
158 <xsl:when test="@role = 'configuration'">
159 <xsl:apply-templates select=".//screen" mode="config"/>
160 </xsl:when>
161 </xsl:choose>
162 </xsl:template>
163
164<!--==================== Download code =======================-->
165
166 <!-- template for extracting the filename from an url in the form:
167 proto://internet.name/dir1/.../dirn/filename?condition.
168 Needed, because substring-after(...,'/') returns only the
169 substring after the first '/'. -->
170 <xsl:template name="package_name">
171 <xsl:param name="url" select="foo"/>
172 <xsl:param name="sub-url" select="substring-after($url,'/')"/>
173 <xsl:choose>
174 <xsl:when test="contains($sub-url,'/')">
175 <xsl:call-template name="package_name">
176 <xsl:with-param name="url" select="$sub-url"/>
177 </xsl:call-template>
178 </xsl:when>
179 <xsl:otherwise>
180 <xsl:choose>
181 <xsl:when test="contains($sub-url,'?')">
182 <xsl:value-of select="substring-before($sub-url,'?')"/>
183 </xsl:when>
184 <xsl:otherwise>
185 <xsl:value-of select="$sub-url"/>
186 </xsl:otherwise>
187 </xsl:choose>
188 </xsl:otherwise>
189 </xsl:choose>
190 </xsl:template>
191
192 <!-- Generates the code to download a package, an additional package or
193 a patch. -->
194 <xsl:template name="download-file">
195 <xsl:param name="httpurl" select="''"/>
196 <xsl:param name="ftpurl" select="''"/>
197 <xsl:param name="md5" select="''"/>
198 <xsl:param name="varname" select="''"/>
199 <xsl:variable name="package">
200 <xsl:call-template name="package_name">
201 <xsl:with-param name="url">
202 <xsl:choose>
203 <xsl:when test="string-length($httpurl) &gt; 10">
204 <xsl:value-of select="$httpurl"/>
205 </xsl:when>
206 <xsl:otherwise>
207 <xsl:value-of select="$ftpurl"/>
208 </xsl:otherwise>
209 </xsl:choose>
210 </xsl:with-param>
211 </xsl:call-template>
212 </xsl:variable>
213 <xsl:variable name="first_letter"
214 select="translate(substring($package,1,1),
215 'ABCDEFGHIJKLMNOPQRSTUVWXYZ',
216 'abcdefghijklmnopqrstuvwxyz')"/>
217 <xsl:text>&#xA;</xsl:text>
218 <xsl:value-of select="$varname"/>
219 <xsl:text>=</xsl:text>
220 <xsl:value-of select="$package"/>
221 <xsl:text>&#xA;if [[ ! -f $</xsl:text>
222 <xsl:value-of select="$varname"/>
223 <xsl:text> ]] ; then&#xA;</xsl:text>
224 <!-- SRC_ARCHIVE may have subdirectories or not -->
225 <xsl:text> if [[ -f $SRC_ARCHIVE/$PKG_DIR/$</xsl:text>
226 <xsl:value-of select="$varname"/>
227 <xsl:text> ]] ; then&#xA;</xsl:text>
228 <xsl:text> cp $SRC_ARCHIVE/$PKG_DIR/$</xsl:text>
229 <xsl:value-of select="$varname"/>
230 <xsl:text> $</xsl:text>
231 <xsl:value-of select="$varname"/>
232 <xsl:text>&#xA;</xsl:text>
233 <xsl:text> elif [[ -f $SRC_ARCHIVE/$</xsl:text>
234 <xsl:value-of select="$varname"/>
235 <xsl:text> ]] ; then&#xA;</xsl:text>
236 <xsl:text> cp $SRC_ARCHIVE/$</xsl:text>
237 <xsl:value-of select="$varname"/>
238 <xsl:text> $</xsl:text>
239 <xsl:value-of select="$varname"/>
240 <xsl:text>&#xA; else&#xA;</xsl:text>
241 <!-- Download from upstream http -->
242 <xsl:if test="string-length($httpurl) &gt; 10">
243 <xsl:text> wget -T 30 -t 5 </xsl:text>
244 <xsl:value-of select="$httpurl"/>
245 <xsl:text> ||&#xA;</xsl:text>
246 </xsl:if>
247 <!-- Download from upstream ftp -->
248 <xsl:if test="string-length($ftpurl) &gt; 10">
249 <xsl:text> wget -T 30 -t 5 </xsl:text>
250 <xsl:value-of select="$ftpurl"/>
251 <xsl:text> ||&#xA;</xsl:text>
252 </xsl:if>
253 <!-- The FTP_SERVER mirror as a last resort -->
254 <xsl:text> wget -T 30 -t 5 ${FTP_SERVER}svn/</xsl:text>
255 <xsl:value-of select="$first_letter"/>
256 <xsl:text>/$</xsl:text>
257 <xsl:value-of select="$varname"/>
258 <xsl:text>
259 cp $</xsl:text>
260 <xsl:value-of select="$varname"/>
261 <xsl:text> $SRC_ARCHIVE
262 fi
263fi
264</xsl:text>
265 <xsl:if test="string-length($md5) &gt; 10">
266 <xsl:text>echo "</xsl:text>
267 <xsl:value-of select="$md5"/>
268 <xsl:text>&#x20;&#x20;$</xsl:text>
269 <xsl:value-of select="$varname"/>
270 <xsl:text>" | md5sum -c -
271</xsl:text>
272 </xsl:if>
273 </xsl:template>
274
275 <!-- Extract the MD5 sum information -->
276 <xsl:template match="para" mode="md5">
277 <xsl:choose>
278 <xsl:when test="contains(substring-after(string(),'sum: '),'&#xA;')">
279 <xsl:value-of select="substring-before(substring-after(string(),'sum: '),'&#xA;')"/>
280 </xsl:when>
281 <xsl:otherwise>
282 <xsl:value-of select="substring-after(string(),'sum: ')"/>
283 </xsl:otherwise>
284 </xsl:choose>
285 </xsl:template>
286
287 <!-- We have several templates itemizedlist, depending on whether we
288 expect the package information, or additional package(s) or patch(es)
289 information. Select the appropriate mode here. -->
290 <xsl:template match="bridgehead">
291 <xsl:choose>
292 <!-- Special case for Openjdk -->
293 <xsl:when test="contains(string(),'Source Package Information')">
294 <xsl:apply-templates
295 select="following-sibling::itemizedlist[1]//simplelist">
296 <xsl:with-param name="varname" select="'PACKAGE'"/>
297 </xsl:apply-templates>
298 <xsl:apply-templates select="following-sibling::itemizedlist
299 [preceding-sibling::bridgehead[1]=current()
300 and position() &gt;1]//simplelist">
301 <xsl:with-param name="varname" select="'PACKAGE1'"/>
302 </xsl:apply-templates>
303 </xsl:when>
304 <!-- Package information -->
305 <xsl:when test="contains(string(),'Package Information')">
306 <xsl:apply-templates select="following-sibling::itemizedlist
307 [preceding-sibling::bridgehead[1]=current()]"
308 mode="package"/>
309 </xsl:when>
310 <!-- Additional package information -->
311 <!-- special case for llvm -->
312 <xsl:when test="contains(string(),'Optional Download')">
313 <xsl:apply-templates select="following-sibling::itemizedlist"
314 mode="additional"/>
315 </xsl:when>
316 <!-- All other additional packages have "Additional" -->
317 <xsl:when test="contains(string(),'Additional')">
318 <xsl:apply-templates select="following-sibling::itemizedlist"
319 mode="additional"/>
320 </xsl:when>
321 <!-- Do not do anything if the dev has created another type of
322 bridgehead. -->
323 <xsl:otherwise/>
324 </xsl:choose>
325 </xsl:template>
326
327 <!-- Call the download code template with appropriate parameters -->
328 <xsl:template match="itemizedlist" mode="package">
329 <xsl:call-template name="download-file">
330 <xsl:with-param name="httpurl">
331 <xsl:value-of select="./listitem[1]/para/ulink/@url"/>
332 </xsl:with-param>
333 <xsl:with-param name="ftpurl">
334 <xsl:value-of select="./listitem/para[contains(string(),'FTP')]/ulink/@url"/>
335 </xsl:with-param>
336 <xsl:with-param name="md5">
337 <xsl:apply-templates select="./listitem/para[contains(string(),'MD5')]"
338 mode="md5"/>
339 </xsl:with-param>
340 <xsl:with-param name="varname" select="'PACKAGE'"/>
341 </xsl:call-template>
342 </xsl:template>
343
344 <xsl:template match="itemizedlist" mode="additional">
345 <!-- The normal layout is "one listitem"<->"one url", but some devs
346 find amusing to have FTP and/or MD5sum listitems, or to
347 enclose the download information inside a simplelist tag... -->
348 <xsl:for-each select="listitem[.//ulink]">
349 <xsl:choose>
350 <!-- hopefully, there was a HTTP line before -->
351 <xsl:when test="contains(string(./para),'FTP')"/>
352 <xsl:when test=".//simplelist">
353 <xsl:apply-templates select=".//simplelist">
354 <xsl:with-param name="varname" select="'PACKAGE1'"/>
355 </xsl:apply-templates>
356 </xsl:when>
357 <xsl:otherwise>
358 <xsl:call-template name="download-file">
359 <xsl:with-param name="httpurl">
360 <xsl:value-of select="./para/ulink/@url"/>
361 </xsl:with-param>
362 <xsl:with-param name="ftpurl">
363 <xsl:value-of
364 select="following-sibling::listitem[1]/
365 para[contains(string(),'FTP')]/ulink/@url"/>
366 </xsl:with-param>
367 <xsl:with-param name="md5">
368 <xsl:apply-templates
369 select="following-sibling::listitem[position()&lt;3]/
370 para[contains(string(),'MD5')]"
371 mode="md5"/>
372 </xsl:with-param>
373 <xsl:with-param name="varname">
374 <xsl:choose>
375 <xsl:when test="contains(./para/ulink/@url,'.patch')">
376 <xsl:text>PATCH</xsl:text>
377 </xsl:when>
378 <xsl:otherwise>
379 <xsl:text>PACKAGE1</xsl:text>
380 </xsl:otherwise>
381 </xsl:choose>
382 </xsl:with-param>
383 </xsl:call-template>
384 </xsl:otherwise>
385 </xsl:choose>
386 </xsl:for-each>
387 </xsl:template>
388
389 <!-- the simplelist case. Hopefully, the layout is one member for
390 url, one for md5 and others for various information, that we do not
391 use -->
392 <xsl:template match="simplelist">
393 <xsl:param name="varname" select="'PACKAGE1'"/>
394 <xsl:call-template name="download-file">
395 <xsl:with-param name="httpurl" select=".//ulink/@url"/>
396 <xsl:with-param name="md5">
397 <xsl:value-of select="substring-after(member[contains(string(),'MD5')],'sum: ')"/>
398 </xsl:with-param>
399 <xsl:with-param name="varname" select="$varname"/>
400 </xsl:call-template>
401 </xsl:template>
402<!--======================== Commands code ==========================-->
403
404 <xsl:template match="screen">
405 <xsl:if test="child::* = userinput and not(@role = 'nodump')">
406 <xsl:choose>
407 <xsl:when test="@role = 'root'">
408 <xsl:if test="not(preceding-sibling::screen[1][@role='root'])">
409 <xsl:if test="$sudo = 'y'">
410 <xsl:text>sudo -E sh &lt;&lt; ROOT_EOF&#xA;</xsl:text>
411 </xsl:if>
412 <xsl:if test="$wrap-install = 'y' and
413 ancestor::sect2[@role='installation']">
414 <xsl:text>if [ -r "$PACK_INSTALL" ]; then
415 source $PACK_INSTALL
416 export -f wrapInstall
417 export -f packInstall
418fi
419wrapInstall '
420</xsl:text>
421 </xsl:if>
422 </xsl:if>
423 <xsl:apply-templates mode="root"/>
424 <xsl:if test="not(following-sibling::screen[1][@role='root'])">
425 <xsl:if test="$wrap-install = 'y' and
426 ancestor::sect2[@role='installation']">
427 <xsl:text>'&#xA;packInstall</xsl:text>
428 </xsl:if>
429 <xsl:if test="$sudo = 'y'">
430 <xsl:text>&#xA;ROOT_EOF</xsl:text>
431 </xsl:if>
432 </xsl:if>
433 </xsl:when>
434 <xsl:otherwise>
435 <xsl:apply-templates select="userinput"/>
436 </xsl:otherwise>
437 </xsl:choose>
438 <xsl:text>&#xA;</xsl:text>
439 </xsl:if>
440 </xsl:template>
441
442 <xsl:template name="set-bootpkg-dir">
443 <xsl:param name="bootpkg" select="'bootscripts'"/>
444 <xsl:param name="url" select="''"/>
445 <xsl:text>[[ ! -d $SRC_DIR/blfs-</xsl:text>
446 <xsl:copy-of select="$bootpkg"/>
447 <xsl:text> ]] &amp;&amp; mkdir $SRC_DIR/blfs-</xsl:text>
448 <xsl:copy-of select="$bootpkg"/>
449 <xsl:text>
450pushd $SRC_DIR/blfs-</xsl:text>
451 <xsl:copy-of select="$bootpkg"/>
452 <xsl:text>
453URL=</xsl:text>
454 <xsl:value-of select="$url"/>
455 <xsl:text>
456BOOTPACKG=$(basename $URL)
457if [[ ! -f $BOOTPACKG ]] ; then
458 if [[ -f $SRC_ARCHIVE/$PKG_DIR/$BOOTPACKG ]] ; then
459 cp $SRC_ARCHIVE/$PKG_DIR/$BOOTPACKG $BOOTPACKG
460 elif [[ -f $SRC_ARCHIVE/$BOOTPACKG ]] ; then
461 cp $SRC_ARCHIVE/$BOOTPACKG $BOOTPACKG
462 else
463 wget -T 30 -t 5 $URL
464 cp $BOOTPACKG $SRC_ARCHIVE
465 fi
466 rm -f unpacked
467fi
468
469if [[ -e unpacked ]] ; then
470 BOOTUNPACKDIR=`head -n1 unpacked | sed 's@^./@@;s@/.*@@'`
471 if ! [[ -d $BOOTUNPACKDIR ]]; then
472 rm unpacked
473 tar -xvf $BOOTPACKG > unpacked
474 BOOTUNPACKDIR=`head -n1 unpacked | sed 's@^./@@;s@/.*@@'`
475 fi
476else
477 tar -xvf $BOOTPACKG > unpacked
478 BOOTUNPACKDIR=`head -n1 unpacked | sed 's@^./@@;s@/.*@@'`
479fi
480cd $BOOTUNPACKDIR
481</xsl:text>
482 </xsl:template>
483
484 <xsl:template match="screen" mode="config">
485 <xsl:if test="preceding-sibling::para[1]/xref[@linkend='bootscripts']">
486 <xsl:call-template name="set-bootpkg-dir">
487 <xsl:with-param name="bootpkg" select="'bootscripts'"/>
488 <xsl:with-param name="url"
489 select="id('bootscripts')//itemizedlist//ulink/@url"/>
490 </xsl:call-template>
491 </xsl:if>
492 <xsl:if test="preceding-sibling::para[1]/xref[@linkend='systemd-units']">
493 <xsl:call-template name="set-bootpkg-dir">
494 <xsl:with-param name="bootpkg" select="'systemd-units'"/>
495 <xsl:with-param name="url"
496 select="id('systemd-units')//itemizedlist//ulink/@url"/>
497 </xsl:call-template>
498 </xsl:if>
499 <xsl:apply-templates select='.'/>
500 <xsl:if test="preceding-sibling::para[1]/xref[@linkend='bootscripts' or
501 @linkend='systemd-units']">
502 <xsl:text>
503popd</xsl:text>
504 </xsl:if>
505 <xsl:text>&#xA;</xsl:text>
506 </xsl:template>
507
508 <xsl:template match="para/command">
509 <xsl:variable name="ns" select="normalize-space(string())"/>
510 <xsl:if test="(contains($ns,'test') or
511 contains($ns,'check'))">
512 <xsl:text>#</xsl:text>
513 <xsl:value-of select="substring-before($ns,'make ')"/>
514 <xsl:text>make </xsl:text>
515 <xsl:if test="not(contains($ns,'-k'))">
516 <xsl:text>-k </xsl:text>
517 </xsl:if>
518 <xsl:value-of select="substring-after($ns,'make ')"/>
519 <xsl:text> || true&#xA;</xsl:text>
520 </xsl:if>
521 </xsl:template>
522
523 <xsl:template match="userinput">
524 <xsl:apply-templates/>
525 </xsl:template>
526
527 <xsl:template match="text()" mode="root">
528 <xsl:call-template name="output-root">
529 <xsl:with-param name="out-string" select="string()"/>
530 </xsl:call-template>
531 </xsl:template>
532
533 <xsl:variable name="APOS">'</xsl:variable>
534
535 <xsl:template name="output-root">
536 <xsl:param name="out-string" select="''"/>
537 <xsl:choose>
538 <xsl:when test="contains($out-string,'make ')">
539 <xsl:call-template name="output-root">
540 <xsl:with-param name="out-string"
541 select="substring-before($out-string,'make ')"/>
542 </xsl:call-template>
543 <xsl:text>make -j1 </xsl:text>
544 <xsl:call-template name="output-root">
545 <xsl:with-param name="out-string"
546 select="substring-after($out-string,'make ')"/>
547 </xsl:call-template>
548 </xsl:when>
549 <xsl:when test="contains($out-string,'$') and $sudo = 'y'">
550 <xsl:call-template name="output-root">
551 <xsl:with-param name="out-string"
552 select="substring-before($out-string,'$')"/>
553 </xsl:call-template>
554 <xsl:text>\$</xsl:text>
555 <xsl:call-template name="output-root">
556 <xsl:with-param name="out-string"
557 select="substring-after($out-string,'$')"/>
558 </xsl:call-template>
559 </xsl:when>
560 <xsl:when test="contains($out-string,'`') and $sudo = 'y'">
561 <xsl:call-template name="output-root">
562 <xsl:with-param name="out-string"
563 select="substring-before($out-string,'`')"/>
564 </xsl:call-template>
565 <xsl:text>\`</xsl:text>
566 <xsl:call-template name="output-root">
567 <xsl:with-param name="out-string"
568 select="substring-after($out-string,'`')"/>
569 </xsl:call-template>
570 </xsl:when>
571 <xsl:when test="contains($out-string,'\') and $sudo = 'y'">
572 <xsl:call-template name="output-root">
573 <xsl:with-param name="out-string"
574 select="substring-before($out-string,'\')"/>
575 </xsl:call-template>
576 <xsl:text>\\</xsl:text>
577 <xsl:call-template name="output-root">
578 <xsl:with-param name="out-string"
579 select="substring-after($out-string,'\')"/>
580 </xsl:call-template>
581 </xsl:when>
582 <xsl:when test="contains($out-string,string($APOS))
583 and $wrap-install = 'y'
584 and ancestor::sect2[@role='installation']">
585 <xsl:call-template name="output-root">
586 <xsl:with-param name="out-string"
587 select="substring-before($out-string,string($APOS))"/>
588 </xsl:call-template>
589 <xsl:text>'\''</xsl:text>
590 <xsl:call-template name="output-root">
591 <xsl:with-param name="out-string"
592 select="substring-after($out-string,string($APOS))"/>
593 </xsl:call-template>
594 </xsl:when>
595 <xsl:otherwise>
596 <xsl:value-of select="$out-string"/>
597 </xsl:otherwise>
598 </xsl:choose>
599 </xsl:template>
600
601 <xsl:template match="replaceable">
602 <xsl:text>**EDITME</xsl:text>
603 <xsl:apply-templates/>
604 <xsl:text>EDITME**</xsl:text>
605 </xsl:template>
606
607 <xsl:template match="replaceable" mode="root">
608 <xsl:text>**EDITME</xsl:text>
609 <xsl:apply-templates/>
610 <xsl:text>EDITME**</xsl:text>
611 </xsl:template>
612
613</xsl:stylesheet>
Note: See TracBrowser for help on using the repository browser.