source: BLFS/xsl/scripts.xsl@ 84440e6

2.4 ablfs-more legacy trunk
Last change on this file since 84440e6 was 70d73d1, checked in by Pierre Labastie <pierre@…>, 8 years ago

Install units when revision is systemd, rather than bootscripts

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