source: BLFS/xsl/scripts.xsl@ 267b19d

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

BLFS tools: Source /etc/profile in scripts

Since this is not done anymore in envars.conf...

  • Property mode set to 100644
File size: 38.7 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<!-- XSLT stylesheet to create shell scripts from "linear build" BLFS books. -->
9
[c048987]10<!-- parameters and global variables -->
11 <!-- Check whether the book is sysv or systemd -->
[70d73d1]12 <xsl:variable name="rev">
13 <xsl:choose>
14 <xsl:when test="//bookinfo/title/phrase[@revision='systemd']">
15 systemd
16 </xsl:when>
17 <xsl:otherwise>
18 sysv
19 </xsl:otherwise>
20 </xsl:choose>
21 </xsl:variable>
22
[945ccaa]23 <!-- Wrap "root" commands inside a wrapper function, allowing
24 "porg style" package management -->
25 <xsl:param name="wrap-install" select="'n'"/>
[9daa202]26 <xsl:param name="pack-install" select="'$HOME/blfs_root/packInstall.sh'"/>
[945ccaa]27
[67c3df4]28 <!-- list of packages needing stats -->
29 <xsl:param name="list-stat" select="''"/>
30
[dc7fd7b]31 <!-- Remove libtool .la files -->
32 <xsl:param name="del-la-files" select="'y'"/>
33
[e576789]34 <!-- Build as user (y) or as root (n)? -->
35 <xsl:param name="sudo" select="'y'"/>
36
[9daa202]37 <!-- Root of sources directory -->
38 <xsl:param name="src-archive" select="'/sources'"/>
39
40 <!-- Download and archive tarballs to subdirs. Can be 'y' or '',
41 not 'n' -->
42 <xsl:param name="src-subdirs" select="''"/>
43
44 <!-- Root of build directory -->
45 <xsl:param name="build-root" select="'/sources'"/>
46
47 <!-- extract sources and build into subdirs. Can be 'y' or '',
48 not 'n' -->
49 <xsl:param name="build-subdirs" select="''"/>
50
51 <!-- Keep files in the build directory after building. Can be 'y' or '',
52 not 'n' -->
53 <xsl:param name="keep-files" select="''"/>
54
55 <!-- Number of parallel jobs; type integer, not string -->
56 <xsl:param name="jobs" select="0"/>
[dc7fd7b]57<!-- simple instructions for removing .la files. -->
[619b313]58<!-- We'll use the rule that any text output begins with a linefeed if needed
59 so that we do not need to output one at the end-->
[dc7fd7b]60 <xsl:variable name="la-files-instr">
61
62for libdir in /lib /usr/lib $(find /opt -name lib); do
[2969cdf]63 find $libdir -name \*.la \
64 ! -path \*ImageMagick\* \
65 -delete
[619b313]66done</xsl:variable>
[67c3df4]67
[c048987]68 <xsl:variable name="list-stat-norm"
69 select="concat(' ', normalize-space($list-stat),' ')"/>
70
71<!-- To be able to use the single quote in tests -->
72 <xsl:variable name="APOS">'</xsl:variable>
73
74<!-- end parameters and global variables -->
75
[7933ed7]76<!-- include the template for processing screen children of
77 role="install" sect2 -->
78 <xsl:include href="process-install.xsl"/>
[c048987]79
[96d7e44]80<!-- include the template for replaceable tags -->
81 <xsl:include href="process-replaceable.xsl"/>
82
[c048987]83<!--=================== Begin processing ========================-->
[67c3df4]84
[e576789]85 <xsl:template match="/">
[c048987]86 <xsl:apply-templates select="//sect1[@id != 'bootscripts' and
87 @id != 'systemd-units']"/>
[e576789]88 </xsl:template>
89
90<!--=================== Master chunks code ======================-->
91
92 <xsl:template match="sect1">
93
[619b313]94 <!-- Are stat requested for this page? -->
95 <xsl:variable name="want-stats"
96 select="contains($list-stat-norm,
97 concat(' ',@id,' '))"/>
98
[c048987]99 <!-- The file names -->
100 <xsl:variable name="filename" select="@id"/>
[e576789]101
[c048987]102 <!-- The build order -->
103 <xsl:variable name="position" select="position()"/>
104 <xsl:variable name="order">
105 <xsl:choose>
106 <xsl:when test="string-length($position) = 1">
107 <xsl:text>00</xsl:text>
108 <xsl:value-of select="$position"/>
109 </xsl:when>
110 <xsl:when test="string-length($position) = 2">
111 <xsl:text>0</xsl:text>
112 <xsl:value-of select="$position"/>
113 </xsl:when>
114 <xsl:otherwise>
115 <xsl:value-of select="$position"/>
116 </xsl:otherwise>
117 </xsl:choose>
118 </xsl:variable>
[e576789]119
120 <!-- Depuration code -->
[c048987]121 <xsl:message>
122 <xsl:text>SCRIPT is </xsl:text>
123 <xsl:value-of select="concat($order,'-z-',$filename)"/>
124 <xsl:text>&#xA; FTPDIR is </xsl:text>
125 <xsl:value-of select="$filename"/>
126 <xsl:text>&#xA;&#xA;</xsl:text>
127 </xsl:message>
128
129 <!-- Creating the scripts -->
130 <exsl:document href="{$order}-z-{$filename}" method="text">
131 <xsl:text>#!/bin/bash
[eabfc59]132set -e
[9daa202]133# Variables coming from configuration
134export JH_PACK_INSTALL="</xsl:text>
135 <xsl:copy-of select="$pack-install"/>
136 <xsl:text>"
137export JH_SRC_ARCHIVE="</xsl:text>
138 <xsl:copy-of select="$src-archive"/>
139 <xsl:text>"
140export JH_SRC_SUBDIRS="</xsl:text>
141 <xsl:copy-of select="$src-subdirs"/>
142 <xsl:text>"
143export JH_BUILD_ROOT="</xsl:text>
144 <xsl:copy-of select="$build-root"/>
145 <xsl:text>"
146export JH_BUILD_SUBDIRS="</xsl:text>
147 <xsl:copy-of select="$build-subdirs"/>
148 <xsl:text>"
149export JH_KEEP_FILES="</xsl:text>
150 <xsl:copy-of select="$keep-files"/>
151 <xsl:text>"
152</xsl:text>
153 <xsl:choose>
154 <xsl:when test="$cfg-cflags = 'EMPTY'">
155 <xsl:text>unset CFLAGS
156</xsl:text>
157 </xsl:when>
158 <xsl:otherwise>
159 <xsl:text>export CFLAGS="</xsl:text>
160 <xsl:copy-of select="$cfg-cflags"/>
161 <xsl:text>"
162</xsl:text>
163 </xsl:otherwise>
164 </xsl:choose>
165 <xsl:choose>
166 <xsl:when test="$cfg-cxxflags = 'EMPTY'">
167 <xsl:text>unset CXXFLAGS
168</xsl:text>
169 </xsl:when>
170 <xsl:otherwise>
171 <xsl:text>export CXXFLAGS="</xsl:text>
172 <xsl:copy-of select="$cfg-cxxflags"/>
173 <xsl:text>"
174</xsl:text>
175 </xsl:otherwise>
176 </xsl:choose>
177 <xsl:choose>
178 <xsl:when test="$cfg-ldflags = 'EMPTY'">
179 <xsl:text>unset LDFLAGS
[eabfc59]180</xsl:text>
[9daa202]181 </xsl:when>
182 <xsl:otherwise>
183 <xsl:text>export LDFLAGS="</xsl:text>
184 <xsl:copy-of select="$cfg-ldflags"/>
185 <xsl:text>"
186</xsl:text>
187 </xsl:otherwise>
188 </xsl:choose>
189<!-- We use MAKEFLAGS and NINJAJOBS for setting the number of
190 parallel jobs. This supposes that ninja has been build with
191 support for NINJAJOBS in lfs. We'll have to change that code
192 if lfs changes its policy for ninja. -->
193 <xsl:text>export MAKEFLAGS="-j</xsl:text>
194 <xsl:choose>
195 <xsl:when test="$jobs = 0">
196 <xsl:text>$(nproc)"
197</xsl:text>
198 </xsl:when>
199 <xsl:otherwise>
200 <xsl:value-of select="$jobs"/>
201 <xsl:text>"
202</xsl:text>
203 </xsl:otherwise>
204 </xsl:choose>
205 <xsl:choose>
206 <xsl:when test="$jobs = 0">
207 <xsl:text>unset NINJAJOBS
208</xsl:text>
209 </xsl:when>
210 <xsl:otherwise>
211 <xsl:text>export NINJAJOBS="</xsl:text>
212 <xsl:value-of select="$jobs"/>
213 <xsl:text>"
214</xsl:text>
215 </xsl:otherwise>
216 </xsl:choose>
[8fc6a47]217<!-- Unsetting MAKELEVEL is needed for some packages which assume that
218 their top level Makefile is at level zero -->
[9daa202]219 <xsl:text>unset MAKELEVEL
[b0965fa]220<!-- When installing several packages, and profile or profile.d
221 has been modified by a previous package, we need to ensure that
222 the updated profile is used.
223-->if [ -r /etc/profile ]; then source /etc/profile; fi
[9daa202]224# End of environment</xsl:text>
225
[c048987]226 <xsl:choose>
227 <!-- Package page -->
228 <xsl:when test="sect2[@role='package']">
229 <!-- We build in a subdirectory, whose name may be needed
[9daa202]230 if using package management, so
[c048987]231 "export" it -->
[619b313]232 <xsl:text>
233export JH_PKG_DIR=</xsl:text>
[c048987]234 <xsl:value-of select="$filename"/>
235 <xsl:text>
[1fa0dee]236SRC_DIR=${JH_SRC_ARCHIVE}${JH_SRC_SUBDIRS:+/${JH_PKG_DIR}}
237BUILD_DIR=${JH_BUILD_ROOT}${JH_BUILD_SUBDIRS:+/${JH_PKG_DIR}}
[39dc04a]238mkdir -p $SRC_DIR
239mkdir -p $BUILD_DIR
240</xsl:text>
[67c3df4]241
[9daa202]242<!-- If stats are requested, include some definitions and initializations -->
[619b313]243 <xsl:if test="$want-stats">
244 <xsl:text>
245INFOLOG=$(pwd)/info-${JH_PKG_DIR}
[9e0c4b6]246TESTLOG=$(pwd)/test-${JH_PKG_DIR}
[9daa202]247echo MAKEFLAGS: $MAKEFLAGS > $INFOLOG
248echo NINJAJOBS: $NINJAJOBS >> $INFOLOG
[c048987]249: > $TESTLOG
[67c3df4]250PKG_DEST=${BUILD_DIR}/dest
251</xsl:text>
[9daa202]252<!-- in some cases, DESTDIR may have been populated by root -->
253 <xsl:if test="$sudo = 'y'">
254 <xsl:text>sudo </xsl:text>
255 </xsl:if>
256 <xsl:text>rm -rf $PKG_DEST
257</xsl:text>
258 </xsl:if><!-- want-stats -->
[c048987]259 <!-- Download code and build commands -->
[619b313]260 <xsl:apply-templates select="sect2">
261 <xsl:with-param name="want-stats" select="$want-stats"/>
262 </xsl:apply-templates>
[c048987]263 <!-- Clean-up -->
[619b313]264 <xsl:text>
265
266cd $BUILD_DIR
[1fa0dee]267[[ -n "$JH_KEEP_FILES" ]] || </xsl:text>
[c048987]268 <!-- In some case, some files in the build tree are owned
269 by root -->
270 <xsl:if test="$sudo='y'">
271 <xsl:text>sudo </xsl:text>
272 </xsl:if>
[619b313]273 <xsl:text>rm -rf $JH_UNPACKDIR unpacked
274</xsl:text>
[c048987]275 </xsl:when>
276 <!-- Non-package page -->
277 <xsl:otherwise>
278 <xsl:apply-templates select=".//screen" mode="not-pack"/>
279 </xsl:otherwise>
280 </xsl:choose>
[619b313]281 <xsl:text>
282exit
283</xsl:text><!-- include a \n at the end of document-->
[c048987]284 </exsl:document>
[e576789]285 </xsl:template>
286
287<!--======================= Sub-sections code =======================-->
288
289 <xsl:template match="sect2">
[619b313]290 <xsl:param name="want-stats" select="false"/>
[e576789]291 <xsl:choose>
[c048987]292
[e576789]293 <xsl:when test="@role = 'package'">
[619b313]294 <xsl:text>
295cd $SRC_DIR</xsl:text>
[642722f]296 <!-- Download information is in bridgehead tags -->
[e576789]297 <xsl:apply-templates select="bridgehead[@renderas='sect3']"/>
[c048987]298 </xsl:when><!-- @role="package" -->
299
[967b819]300 <xsl:when test="@role = 'qt4-prefix' or @role = 'qt5-prefix'">
[625cb14]301 <xsl:apply-templates select=".//screen[./userinput]"/>
[967b819]302 </xsl:when>
[c048987]303
[0a0b609]304 <xsl:when test="@role = 'installation' and
305 not(preceding-sibling::sect2[@role = 'installation'])">
[e576789]306 <xsl:text>
[39dc04a]307cd $BUILD_DIR
[07f7eff]308find . -maxdepth 1 -mindepth 1 -type d | xargs </xsl:text>
309 <xsl:if test="$sudo='y'">
310 <xsl:text>sudo </xsl:text>
311 </xsl:if>
312 <xsl:text>rm -rf
[67c3df4]313</xsl:text>
[619b313]314 <!-- If stats are requested, insert the start size -->
315 <xsl:if test="$want-stats">
316 <xsl:text>
[59c4761]317echo Start Size: $(sudo du -skx --exclude home $BUILD_DIR) >> $INFOLOG
[67c3df4]318</xsl:text>
319 </xsl:if>
320
[619b313]321 <xsl:text>
322case $PACKAGE in
[e6967a1]323 *.tar.gz|*.tar.bz2|*.tar.xz|*.tgz|*.tar.lzma)
[39dc04a]324 tar -xvf $SRC_DIR/$PACKAGE &gt; unpacked
[1fa0dee]325 JH_UNPACKDIR=`grep '[^./]\+' unpacked | head -n1 | sed 's@^\./@@;s@/.*@@'`
[6eaae5e]326 ;;
327 *.tar.lz)
[39dc04a]328 bsdtar -xvf $SRC_DIR/$PACKAGE 2&gt; unpacked
[1fa0dee]329 JH_UNPACKDIR=`head -n1 unpacked | cut -d" " -f2 | sed 's@^\./@@;s@/.*@@'`
[67992a0]330 ;;
331 *.zip)
[39dc04a]332 zipinfo -1 $SRC_DIR/$PACKAGE &gt; unpacked
[1fa0dee]333 JH_UNPACKDIR="$(sed 's@/.*@@' unpacked | uniq )"
334 if test $(wc -w &lt;&lt;&lt; $JH_UNPACKDIR) -eq 1; then
[39dc04a]335 unzip $SRC_DIR/$PACKAGE
[67992a0]336 else
[1fa0dee]337 JH_UNPACKDIR=${PACKAGE%.zip}
338 unzip -d $JH_UNPACKDIR $SRC_DIR/$PACKAGE
[67992a0]339 fi
340 ;;
341 *)
[1fa0dee]342 JH_UNPACKDIR=$JH_PKG_DIR-build
343 mkdir $JH_UNPACKDIR
344 cp $SRC_DIR/$PACKAGE $JH_UNPACKDIR
[619b313]345 ADDITIONAL="$(find . -mindepth 1 -maxdepth 1 -type l)"
346 if [ -n "$ADDITIONAL" ]; then
347 cp $ADDITIONAL $JH_UNPACKDIR
348 fi
[67992a0]349 ;;
350esac
[1fa0dee]351export JH_UNPACKDIR
[619b313]352cd $JH_UNPACKDIR
[67992a0]353</xsl:text>
[619b313]354 <!-- If stats are requested, insert the start time -->
355 <xsl:if test="$want-stats">
356 <xsl:text>
357echo Start Time: ${SECONDS} >> $INFOLOG
[67c3df4]358</xsl:text>
359 </xsl:if>
360
[7933ed7]361 <xsl:call-template name="process-install">
362 <xsl:with-param
363 name="instruction-tree"
[625cb14]364 select=".//screen[not(@role = 'nodump') and ./userinput] |
[c048987]365 .//para/command[contains(text(),'check') or
[7933ed7]366 contains(text(),'test')]"/>
[619b313]367 <xsl:with-param name="want-stats" select="$want-stats"/>
[7933ed7]368 <xsl:with-param name="root-seen" select="boolean(0)"/>
369 <xsl:with-param name="install-seen" select="boolean(0)"/>
370 <xsl:with-param name="test-seen" select="boolean(0)"/>
371 <xsl:with-param name="doc-seen" select="boolean(0)"/>
372 </xsl:call-template>
[619b313]373 <xsl:text>
374</xsl:text>
[e576789]375 <xsl:if test="$sudo = 'y'">
376 <xsl:text>sudo /sbin/</xsl:text>
377 </xsl:if>
[619b313]378 <xsl:text>ldconfig</xsl:text>
[c048987]379 </xsl:when><!-- @role="installation" -->
380
[e576789]381 <xsl:when test="@role = 'configuration'">
[619b313]382 <xsl:text>&#xA;</xsl:text>
[625cb14]383 <xsl:apply-templates mode="config"
384 select=".//screen[not(@role = 'nodump') and ./userinput]"/>
[c048987]385 </xsl:when><!-- @role="configuration" -->
386
[e576789]387 </xsl:choose>
388 </xsl:template>
389
390<!--==================== Download code =======================-->
391
[642722f]392 <!-- template for extracting the filename from an url in the form:
393 proto://internet.name/dir1/.../dirn/filename?condition.
394 Needed, because substring-after(...,'/') returns only the
395 substring after the first '/'. -->
[e576789]396 <xsl:template name="package_name">
397 <xsl:param name="url" select="foo"/>
398 <xsl:param name="sub-url" select="substring-after($url,'/')"/>
399 <xsl:choose>
400 <xsl:when test="contains($sub-url,'/')">
401 <xsl:call-template name="package_name">
402 <xsl:with-param name="url" select="$sub-url"/>
403 </xsl:call-template>
404 </xsl:when>
405 <xsl:otherwise>
406 <xsl:choose>
407 <xsl:when test="contains($sub-url,'?')">
408 <xsl:value-of select="substring-before($sub-url,'?')"/>
409 </xsl:when>
410 <xsl:otherwise>
411 <xsl:value-of select="$sub-url"/>
412 </xsl:otherwise>
413 </xsl:choose>
414 </xsl:otherwise>
415 </xsl:choose>
416 </xsl:template>
417
[642722f]418 <!-- Generates the code to download a package, an additional package or
419 a patch. -->
420 <xsl:template name="download-file">
421 <xsl:param name="httpurl" select="''"/>
422 <xsl:param name="ftpurl" select="''"/>
423 <xsl:param name="md5" select="''"/>
424 <xsl:param name="varname" select="''"/>
425 <xsl:variable name="package">
426 <xsl:call-template name="package_name">
427 <xsl:with-param name="url">
[e576789]428 <xsl:choose>
[642722f]429 <xsl:when test="string-length($httpurl) &gt; 10">
430 <xsl:value-of select="$httpurl"/>
[e576789]431 </xsl:when>
432 <xsl:otherwise>
[642722f]433 <xsl:value-of select="$ftpurl"/>
[e576789]434 </xsl:otherwise>
435 </xsl:choose>
[642722f]436 </xsl:with-param>
437 </xsl:call-template>
438 </xsl:variable>
439 <xsl:variable name="first_letter"
440 select="translate(substring($package,1,1),
441 'ABCDEFGHIJKLMNOPQRSTUVWXYZ',
442 'abcdefghijklmnopqrstuvwxyz')"/>
443 <xsl:text>&#xA;</xsl:text>
444 <xsl:value-of select="$varname"/>
445 <xsl:text>=</xsl:text>
446 <xsl:value-of select="$package"/>
447 <xsl:text>&#xA;if [[ ! -f $</xsl:text>
448 <xsl:value-of select="$varname"/>
[8dc4646]449 <xsl:text> ]] ; then
[9daa202]450 if [ -f "$JH_SRC_ARCHIVE/$</xsl:text>
[642722f]451 <xsl:value-of select="$varname"/>
[9daa202]452 <xsl:text>" ] ; then&#xA;</xsl:text>
453 <xsl:text> cp "$JH_SRC_ARCHIVE/$</xsl:text>
[642722f]454 <xsl:value-of select="$varname"/>
[9daa202]455 <xsl:text>" "$</xsl:text>
[642722f]456 <xsl:value-of select="$varname"/>
[9daa202]457 <xsl:text>"
[8dc4646]458 else&#xA;</xsl:text>
[342c862]459 <!-- Download from upstream http -->
[642722f]460 <xsl:if test="string-length($httpurl) &gt; 10">
[9daa202]461 <xsl:text> wget -T 30 -t 5 "</xsl:text>
[642722f]462 <xsl:value-of select="$httpurl"/>
[9daa202]463 <xsl:text>" ||&#xA;</xsl:text>
[642722f]464 </xsl:if>
[342c862]465 <!-- Download from upstream ftp -->
[642722f]466 <xsl:if test="string-length($ftpurl) &gt; 10">
[9daa202]467 <xsl:text> wget -T 30 -t 5 "</xsl:text>
[642722f]468 <xsl:value-of select="$ftpurl"/>
[9daa202]469 <xsl:text>" ||&#xA;</xsl:text>
[642722f]470 </xsl:if>
[342c862]471 <!-- The FTP_SERVER mirror as a last resort -->
[9daa202]472 <xsl:text> wget -T 30 -t 5 "${JH_FTP_SERVER}svn/</xsl:text>
[342c862]473 <xsl:value-of select="$first_letter"/>
474 <xsl:text>/$</xsl:text>
475 <xsl:value-of select="$varname"/>
[9daa202]476 <xsl:text>"
[8dc4646]477 fi
[619b313]478fi</xsl:text>
[642722f]479 <xsl:if test="string-length($md5) &gt; 10">
[619b313]480 <xsl:text>
481echo "</xsl:text>
[642722f]482 <xsl:value-of select="$md5"/>
483 <xsl:text>&#x20;&#x20;$</xsl:text>
484 <xsl:value-of select="$varname"/>
[619b313]485 <xsl:text>" | md5sum -c -</xsl:text>
[39dc04a]486 </xsl:if>
487<!-- link additional packages into $BUILD_DIR, because they are supposed to
488 be there-->
489 <xsl:if test="string($varname) != 'PACKAGE'">
[619b313]490 <xsl:text>
[9daa202]491[ "$SRC_DIR" != "$BUILD_DIR" ] &amp;&amp; ln -sf "$SRC_DIR/$</xsl:text>
[39dc04a]492 <xsl:value-of select="$varname"/>
[9daa202]493 <xsl:text>" "$BUILD_DIR"</xsl:text>
[642722f]494 </xsl:if>
[619b313]495 <xsl:text>&#xA;</xsl:text>
[642722f]496 </xsl:template>
497
498 <!-- Extract the MD5 sum information -->
499 <xsl:template match="para" mode="md5">
500 <xsl:choose>
501 <xsl:when test="contains(substring-after(string(),'sum: '),'&#xA;')">
502 <xsl:value-of select="substring-before(substring-after(string(),'sum: '),'&#xA;')"/>
[e576789]503 </xsl:when>
[642722f]504 <xsl:otherwise>
505 <xsl:value-of select="substring-after(string(),'sum: ')"/>
506 </xsl:otherwise>
[e576789]507 </xsl:choose>
508 </xsl:template>
509
[642722f]510 <!-- We have several templates itemizedlist, depending on whether we
511 expect the package information, or additional package(s) or patch(es)
512 information. Select the appropriate mode here. -->
513 <xsl:template match="bridgehead">
[e576789]514 <xsl:choose>
[642722f]515 <!-- Special case for Openjdk -->
516 <xsl:when test="contains(string(),'Source Package Information')">
517 <xsl:apply-templates
518 select="following-sibling::itemizedlist[1]//simplelist">
519 <xsl:with-param name="varname" select="'PACKAGE'"/>
520 </xsl:apply-templates>
521 <xsl:apply-templates select="following-sibling::itemizedlist
522 [preceding-sibling::bridgehead[1]=current()
523 and position() &gt;1]//simplelist">
524 <xsl:with-param name="varname" select="'PACKAGE1'"/>
525 </xsl:apply-templates>
[e576789]526 </xsl:when>
[642722f]527 <!-- Package information -->
528 <xsl:when test="contains(string(),'Package Information')">
529 <xsl:apply-templates select="following-sibling::itemizedlist
530 [preceding-sibling::bridgehead[1]=current()]"
531 mode="package"/>
[e576789]532 </xsl:when>
[642722f]533 <!-- Additional package information -->
[2873df6]534 <!-- special cases for llvm -->
[bfc99d1]535 <xsl:when test="contains(string(),'Recommended Download')">
[2873df6]536 <xsl:apply-templates select="following-sibling::itemizedlist[1]"
537 mode="additional"/>
538 </xsl:when>
[ba57e61]539 <xsl:when test="contains(string(),'Optional Download')">
540 <xsl:apply-templates select="following-sibling::itemizedlist"
541 mode="additional"/>
542 </xsl:when>
543 <!-- All other additional packages have "Additional" -->
[642722f]544 <xsl:when test="contains(string(),'Additional')">
545 <xsl:apply-templates select="following-sibling::itemizedlist"
546 mode="additional"/>
[e576789]547 </xsl:when>
[642722f]548 <!-- Do not do anything if the dev has created another type of
549 bridgehead. -->
550 <xsl:otherwise/>
[e576789]551 </xsl:choose>
552 </xsl:template>
553
[642722f]554 <!-- Call the download code template with appropriate parameters -->
555 <xsl:template match="itemizedlist" mode="package">
556 <xsl:call-template name="download-file">
557 <xsl:with-param name="httpurl">
558 <xsl:value-of select="./listitem[1]/para/ulink/@url"/>
559 </xsl:with-param>
560 <xsl:with-param name="ftpurl">
561 <xsl:value-of select="./listitem/para[contains(string(),'FTP')]/ulink/@url"/>
562 </xsl:with-param>
563 <xsl:with-param name="md5">
564 <xsl:apply-templates select="./listitem/para[contains(string(),'MD5')]"
565 mode="md5"/>
566 </xsl:with-param>
567 <xsl:with-param name="varname" select="'PACKAGE'"/>
568 </xsl:call-template>
[e576789]569 </xsl:template>
570
[642722f]571 <xsl:template match="itemizedlist" mode="additional">
572 <!-- The normal layout is "one listitem"<->"one url", but some devs
573 find amusing to have FTP and/or MD5sum listitems, or to
574 enclose the download information inside a simplelist tag... -->
575 <xsl:for-each select="listitem[.//ulink]">
576 <xsl:choose>
577 <!-- hopefully, there was a HTTP line before -->
578 <xsl:when test="contains(string(./para),'FTP')"/>
579 <xsl:when test=".//simplelist">
580 <xsl:apply-templates select=".//simplelist">
581 <xsl:with-param name="varname" select="'PACKAGE1'"/>
582 </xsl:apply-templates>
583 </xsl:when>
584 <xsl:otherwise>
585 <xsl:call-template name="download-file">
586 <xsl:with-param name="httpurl">
587 <xsl:value-of select="./para/ulink/@url"/>
588 </xsl:with-param>
589 <xsl:with-param name="ftpurl">
590 <xsl:value-of
591 select="following-sibling::listitem[1]/
592 para[contains(string(),'FTP')]/ulink/@url"/>
593 </xsl:with-param>
594 <xsl:with-param name="md5">
595 <xsl:apply-templates
596 select="following-sibling::listitem[position()&lt;3]/
597 para[contains(string(),'MD5')]"
598 mode="md5"/>
599 </xsl:with-param>
600 <xsl:with-param name="varname">
601 <xsl:choose>
602 <xsl:when test="contains(./para/ulink/@url,'.patch')">
603 <xsl:text>PATCH</xsl:text>
604 </xsl:when>
605 <xsl:otherwise>
606 <xsl:text>PACKAGE1</xsl:text>
607 </xsl:otherwise>
608 </xsl:choose>
609 </xsl:with-param>
610 </xsl:call-template>
611 </xsl:otherwise>
612 </xsl:choose>
613 </xsl:for-each>
[e576789]614 </xsl:template>
615
[642722f]616 <!-- the simplelist case. Hopefully, the layout is one member for
617 url, one for md5 and others for various information, that we do not
618 use -->
619 <xsl:template match="simplelist">
620 <xsl:param name="varname" select="'PACKAGE1'"/>
621 <xsl:call-template name="download-file">
622 <xsl:with-param name="httpurl" select=".//ulink/@url"/>
623 <xsl:with-param name="md5">
624 <xsl:value-of select="substring-after(member[contains(string(),'MD5')],'sum: ')"/>
625 </xsl:with-param>
626 <xsl:with-param name="varname" select="$varname"/>
627 </xsl:call-template>
628 </xsl:template>
[625cb14]629
630<!--====================== Non package code =========================-->
631
632 <xsl:template match="screen" mode="not-pack">
633 <xsl:choose>
[6622409]634 <xsl:when test="@role='nodump'"/>
[625cb14]635 <xsl:when test="ancestor::sect1[@id='postlfs-config-vimrc']">
636 <xsl:text>
637cat > ~/.vimrc &lt;&lt;EOF
638</xsl:text>
639 <xsl:apply-templates/>
640 <xsl:text>
641EOF
642</xsl:text>
643 </xsl:when>
644 <xsl:otherwise>
645 <xsl:apply-templates select="." mode="config"/>
646 </xsl:otherwise>
647 </xsl:choose>
648 </xsl:template>
[e576789]649<!--======================== Commands code ==========================-->
[c048987]650<!-- Code for installation instructions is in gen-install.xsl -->
[e576789]651
652 <xsl:template match="screen">
[c048987]653 <xsl:choose>
654<!-- instructions run as root (configuration mainly) -->
655 <xsl:when test="@role = 'root'">
[aeb8539]656<!-- templates begin/end-root are in gen-install.xsl -->
[c048987]657 <xsl:if test="not(preceding-sibling::screen[1][@role='root'])">
[aeb8539]658 <xsl:call-template name="begin-root"/>
[c048987]659 </xsl:if>
660 <xsl:apply-templates mode="root"/>
661 <xsl:if test="not(following-sibling::screen[1][@role='root'])">
[aeb8539]662 <xsl:call-template name="end-root"/>
[c048987]663 </xsl:if>
664 </xsl:when>
[67c3df4]665<!-- then all the instructions run as user -->
[c048987]666 <xsl:otherwise>
667 <xsl:apply-templates select="userinput"/>
668 </xsl:otherwise>
669 </xsl:choose>
[e576789]670 </xsl:template>
671
[8fc6a47]672<!-- Templates for bootscripts/units installation -->
[70d73d1]673 <xsl:template name="set-bootpkg-dir">
674 <xsl:param name="bootpkg" select="'bootscripts'"/>
675 <xsl:param name="url" select="''"/>
[619b313]676 <xsl:text>
677BOOTPKG_DIR=blfs-</xsl:text>
[70d73d1]678 <xsl:copy-of select="$bootpkg"/>
679 <xsl:text>
[619b313]680
[1fa0dee]681BOOTSRC_DIR=${JH_SRC_ARCHIVE}${JH_SRC_SUBDIRS:+/${BOOTPKG_DIR}}
682BOOTBUILD_DIR=${JH_BUILD_ROOT}${JH_BUILD_SUBDIRS:+/${BOOTPKG_DIR}}
[973c767]683mkdir -p $BOOTSRC_DIR
684mkdir -p $BOOTBUILD_DIR
685
686pushd $BOOTSRC_DIR
[e576789]687URL=</xsl:text>
[70d73d1]688 <xsl:value-of select="$url"/>
689 <xsl:text>
[e576789]690BOOTPACKG=$(basename $URL)
[bbcdeab]691if [[ ! -f $BOOTPACKG ]] ; then
[1fa0dee]692 if [[ -f $JH_SRC_ARCHIVE/$BOOTPACKG ]] ; then
693 cp $JH_SRC_ARCHIVE/$BOOTPACKG $BOOTPACKG
[bbcdeab]694 else
695 wget -T 30 -t 5 $URL
696 fi
[973c767]697 rm -f $BOOTBUILD_DIR/unpacked
[bbcdeab]698fi
699
[973c767]700cd $BOOTBUILD_DIR
[e576789]701if [[ -e unpacked ]] ; then
[f079f8f]702 BOOTUNPACKDIR=`head -n1 unpacked | sed 's@^./@@;s@/.*@@'`
703 if ! [[ -d $BOOTUNPACKDIR ]]; then
[973c767]704 tar -xvf $BOOTSRC_DIR/$BOOTPACKG > unpacked
[f079f8f]705 BOOTUNPACKDIR=`head -n1 unpacked | sed 's@^./@@;s@/.*@@'`
[e576789]706 fi
707else
[973c767]708 tar -xvf $BOOTSRC_DIR/$BOOTPACKG > unpacked
[f079f8f]709 BOOTUNPACKDIR=`head -n1 unpacked | sed 's@^./@@;s@/.*@@'`
[e576789]710fi
[619b313]711cd $BOOTUNPACKDIR</xsl:text>
[70d73d1]712 </xsl:template>
713
714 <xsl:template match="screen" mode="config">
715 <xsl:if test="preceding-sibling::para[1]/xref[@linkend='bootscripts']">
[aeb8539]716<!-- if the preceding "screen" tag is role="root", and we are role="root"
717 the end-root has not been called. So do it -->
[619b313]718 <xsl:if
719 test="preceding-sibling::screen[1][@role='root'] and @role='root'">
[aeb8539]720 <xsl:call-template name="end-root"/>
721 </xsl:if>
[70d73d1]722 <xsl:call-template name="set-bootpkg-dir">
723 <xsl:with-param name="bootpkg" select="'bootscripts'"/>
724 <xsl:with-param name="url"
725 select="id('bootscripts')//itemizedlist//ulink/@url"/>
726 </xsl:call-template>
[aeb8539]727<!-- if the preceding "screen" tag is role="root", and we are role="root"
728 the begin-root will not be called. So do it -->
[619b313]729 <xsl:if
730 test="preceding-sibling::screen[1][@role='root'] and @role='root'">
[aeb8539]731 <xsl:call-template name="begin-root"/>
732 </xsl:if>
[70d73d1]733 </xsl:if>
734 <xsl:if test="preceding-sibling::para[1]/xref[@linkend='systemd-units']">
[aeb8539]735<!-- if the preceding "screen" tag is role="root", and we are role="root"
736 the end-root has not been called. So do it -->
[619b313]737 <xsl:if
738 test="preceding-sibling::screen[1][@role='root'] and @role='root'">
[aeb8539]739 <xsl:call-template name="end-root"/>
740 </xsl:if>
[70d73d1]741 <xsl:call-template name="set-bootpkg-dir">
742 <xsl:with-param name="bootpkg" select="'systemd-units'"/>
743 <xsl:with-param name="url"
744 select="id('systemd-units')//itemizedlist//ulink/@url"/>
745 </xsl:call-template>
[aeb8539]746<!-- if the preceding "screen" tag is role="root", and we are role="root"
747 the begin-root will not be called. So do it -->
[619b313]748 <xsl:if
749 test="preceding-sibling::screen[1][@role='root'] and @role='root'">
[aeb8539]750 <xsl:call-template name="begin-root"/>
751 </xsl:if>
[e576789]752 </xsl:if>
753 <xsl:apply-templates select='.'/>
[70d73d1]754 <xsl:if test="preceding-sibling::para[1]/xref[@linkend='bootscripts' or
755 @linkend='systemd-units']">
[aeb8539]756<!-- if the next "screen" tag is role="root", and we are role="root"
757 the end-root has not been called. So do it -->
[619b313]758 <xsl:if
759 test="following-sibling::screen[1][@role='root'] and @role='root'">
[aeb8539]760 <xsl:call-template name="end-root"/>
761 </xsl:if>
[619b313]762 <xsl:text>
763popd</xsl:text>
[aeb8539]764<!-- if the next "screen" tag is role="root", and we are role="root"
765 the begin-root will not be called. So do it -->
[619b313]766 <xsl:if
767 test="following-sibling::screen[1][@role='root'] and @role='root'">
[aeb8539]768 <xsl:call-template name="begin-root"/>
769 </xsl:if>
[e576789]770 </xsl:if>
771 </xsl:template>
772
[c048987]773 <xsl:template match="command" mode="installation">
[619b313]774 <xsl:param name="want-stats" select="false"/>
[a743e57]775 <xsl:variable name="ns" select="normalize-space(string())"/>
[c048987]776 <xsl:variable name="first"
777 select="not(
778 boolean(
779 preceding-sibling::command[contains(text(),'check') or
780 contains(text(),'test')]))"/>
781 <xsl:variable name="last"
782 select="not(
783 boolean(
784 following-sibling::command[contains(text(),'check') or
785 contains(text(),'test')]))"/>
786 <xsl:choose>
[619b313]787 <xsl:when test="$want-stats">
[c048987]788 <xsl:if test="$first">
[67c3df4]789 <xsl:text>
[619b313]790
[67c3df4]791echo Time after make: ${SECONDS} >> $INFOLOG
[59c4761]792echo Size after make: $(sudo du -skx --exclude home $BUILD_DIR) >> $INFOLOG
[67c3df4]793echo Time before test: ${SECONDS} >> $INFOLOG
[c048987]794
[67c3df4]795</xsl:text>
[c048987]796 </xsl:if>
797 </xsl:when>
798 <xsl:otherwise>
[619b313]799 <xsl:text>
800#</xsl:text>
[c048987]801 </xsl:otherwise>
802 </xsl:choose>
803 <xsl:choose>
804 <xsl:when test="contains($ns,'make')">
805 <xsl:value-of select="substring-before($ns,'make ')"/>
806 <xsl:text>make </xsl:text>
807 <xsl:if test="not(contains($ns,'-k'))">
808 <xsl:text>-k </xsl:text>
809 </xsl:if>
810 <xsl:value-of select="substring-after($ns,'make ')"/>
811 </xsl:when>
812 <xsl:otherwise>
813 <xsl:copy-of select="$ns"/>
814 </xsl:otherwise>
815 </xsl:choose>
[619b313]816 <xsl:if test="$want-stats">
[c048987]817 <xsl:text> &gt;&gt; $TESTLOG 2&gt;&amp;1</xsl:text>
[e576789]818 </xsl:if>
[619b313]819 <xsl:text> || true</xsl:text>
820 <xsl:if test="$want-stats">
[c048987]821 <xsl:text>
[619b313]822
[c048987]823echo Time after test: ${SECONDS} >> $INFOLOG
[59c4761]824echo Size after test: $(sudo du -skx --exclude home $BUILD_DIR) >> $INFOLOG
[c048987]825echo Time before install: ${SECONDS} >> $INFOLOG
826</xsl:text>
827 </xsl:if>
[e576789]828 </xsl:template>
829
[8fc6a47]830 <xsl:template match="userinput|command">
[619b313]831 <xsl:text>
832</xsl:text>
[e576789]833 <xsl:apply-templates/>
834 </xsl:template>
835
[619b313]836 <xsl:template match="userinput" mode="root">
837 <xsl:text>
838</xsl:text>
839 <xsl:apply-templates mode="root"/>
840 </xsl:template>
841
[aeb8539]842 <xsl:template match="text()">
843 <xsl:call-template name="remove-ampersand">
844 <xsl:with-param name="out-string" select="string()"/>
845 </xsl:call-template>
846 </xsl:template>
847
[e576789]848 <xsl:template match="text()" mode="root">
849 <xsl:call-template name="output-root">
850 <xsl:with-param name="out-string" select="string()"/>
851 </xsl:call-template>
852 </xsl:template>
853
854 <xsl:template name="output-root">
855 <xsl:param name="out-string" select="''"/>
856 <xsl:choose>
857 <xsl:when test="contains($out-string,'$') and $sudo = 'y'">
858 <xsl:call-template name="output-root">
859 <xsl:with-param name="out-string"
860 select="substring-before($out-string,'$')"/>
861 </xsl:call-template>
862 <xsl:text>\$</xsl:text>
863 <xsl:call-template name="output-root">
864 <xsl:with-param name="out-string"
865 select="substring-after($out-string,'$')"/>
866 </xsl:call-template>
867 </xsl:when>
868 <xsl:when test="contains($out-string,'`') and $sudo = 'y'">
869 <xsl:call-template name="output-root">
870 <xsl:with-param name="out-string"
871 select="substring-before($out-string,'`')"/>
872 </xsl:call-template>
873 <xsl:text>\`</xsl:text>
874 <xsl:call-template name="output-root">
875 <xsl:with-param name="out-string"
876 select="substring-after($out-string,'`')"/>
877 </xsl:call-template>
878 </xsl:when>
879 <xsl:when test="contains($out-string,'\') and $sudo = 'y'">
880 <xsl:call-template name="output-root">
881 <xsl:with-param name="out-string"
882 select="substring-before($out-string,'\')"/>
883 </xsl:call-template>
884 <xsl:text>\\</xsl:text>
885 <xsl:call-template name="output-root">
886 <xsl:with-param name="out-string"
887 select="substring-after($out-string,'\')"/>
888 </xsl:call-template>
889 </xsl:when>
890 <xsl:otherwise>
[aeb8539]891 <xsl:call-template name="remove-ampersand">
892 <xsl:with-param name="out-string" select="$out-string"/>
893 </xsl:call-template>
894<!-- <xsl:value-of select="$out-string"/> -->
[e576789]895 </xsl:otherwise>
896 </xsl:choose>
897 </xsl:template>
898
[67c3df4]899 <xsl:template name="output-destdir">
900 <xsl:apply-templates
901 select="userinput|following-sibling::screen[@role='root']/userinput"
902 mode="destdir"/>
903 <xsl:text>
[619b313]904
[67c3df4]905echo Time after install: ${SECONDS} >> $INFOLOG
[59c4761]906echo Size after install: $(sudo du -skx --exclude home $BUILD_DIR) >> $INFOLOG
[67c3df4]907</xsl:text>
908 </xsl:template>
909
910 <xsl:template match="userinput" mode="destdir">
[8fc6a47]911 <xsl:text>
912</xsl:text>
[67c3df4]913 <xsl:choose>
914 <xsl:when test="./literal">
915 <xsl:call-template name="outputpkgdest">
916 <xsl:with-param name="outputstring" select="text()[1]"/>
917 </xsl:call-template>
918 <xsl:apply-templates select="literal"/>
919 <xsl:call-template name="outputpkgdest">
920 <xsl:with-param name="outputstring" select="text()[2]"/>
921 </xsl:call-template>
922 </xsl:when>
923 <xsl:otherwise>
924 <xsl:call-template name="outputpkgdest">
925 <xsl:with-param name="outputstring" select="string()"/>
926 </xsl:call-template>
927 </xsl:otherwise>
928 </xsl:choose>
929 </xsl:template>
930
931 <xsl:template name="outputpkgdest">
932 <xsl:param name="outputstring" select="'foo'"/>
933 <xsl:choose>
934 <xsl:when test="contains($outputstring,'make ')">
935 <xsl:choose>
936 <xsl:when test="not(starts-with($outputstring,'make'))">
937 <xsl:call-template name="outputpkgdest">
938 <xsl:with-param name="outputstring"
939 select="substring-before($outputstring,'make')"/>
940 </xsl:call-template>
941 <xsl:call-template name="outputpkgdest">
942 <xsl:with-param
943 name="outputstring"
944 select="substring-after($outputstring,
945 substring-before($outputstring,'make'))"/>
946 </xsl:call-template>
947 </xsl:when>
948 <xsl:otherwise>
[619b313]949 <xsl:text>
950make DESTDIR=$PKG_DEST</xsl:text>
[67c3df4]951 <xsl:call-template name="outputpkgdest">
952 <xsl:with-param
953 name="outputstring"
954 select="substring-after($outputstring,'make')"/>
955 </xsl:call-template>
956 </xsl:otherwise>
957 </xsl:choose>
958 </xsl:when>
959 <xsl:when test="contains($outputstring,'ninja install')">
960 <xsl:choose>
961 <xsl:when test="not(starts-with($outputstring,'ninja install'))">
962 <xsl:call-template name="outputpkgdest">
963 <xsl:with-param name="outputstring"
964 select="substring-before($outputstring,'ninja install')"/>
965 </xsl:call-template>
966 <xsl:call-template name="outputpkgdest">
967 <xsl:with-param
968 name="outputstring"
969 select="substring-after($outputstring,
970 substring-before($outputstring,'ninja install'))"/>
971 </xsl:call-template>
972 </xsl:when>
973 <xsl:otherwise>
[619b313]974 <xsl:text>
975DESTDIR=$PKG_DEST ninja</xsl:text>
[67c3df4]976 <xsl:call-template name="outputpkgdest">
977 <xsl:with-param
978 name="outputstring"
979 select="substring-after($outputstring,'ninja')"/>
980 </xsl:call-template>
981 </xsl:otherwise>
982 </xsl:choose>
983 </xsl:when>
984 <xsl:otherwise> <!-- no make nor ninja in this string -->
985 <xsl:choose>
986 <xsl:when test="contains($outputstring,'&gt;/') and
987 not(contains(substring-before($outputstring,'&gt;/'),' /'))">
[aeb8539]988 <xsl:call-template name="remove-ampersand">
989 <xsl:with-param name="out-string"
990 select="substring-before($outputstring,'&gt;/')"/>
991 </xsl:call-template>
992<!-- <xsl:value-of select="substring-before($outputstring,'&gt;/')"/>-->
[67c3df4]993 <xsl:text>&gt;$PKG_DEST/</xsl:text>
994 <xsl:call-template name="outputpkgdest">
995 <xsl:with-param name="outputstring" select="substring-after($outputstring,'&gt;/')"/>
996 </xsl:call-template>
997 </xsl:when>
998 <xsl:when test="contains($outputstring,' /')">
[aeb8539]999 <xsl:call-template name="remove-ampersand">
1000 <xsl:with-param name="out-string"
1001 select="substring-before($outputstring,' /')"/>
1002 </xsl:call-template>
1003<!-- <xsl:value-of select="substring-before($outputstring,' /')"/>-->
[67c3df4]1004 <xsl:text> $PKG_DEST/</xsl:text>
1005 <xsl:call-template name="outputpkgdest">
1006 <xsl:with-param name="outputstring" select="substring-after($outputstring,' /')"/>
1007 </xsl:call-template>
1008 </xsl:when>
1009 <xsl:otherwise>
[aeb8539]1010 <xsl:call-template name="remove-ampersand">
1011 <xsl:with-param name="out-string" select="$outputstring"/>
1012 </xsl:call-template>
1013<!-- <xsl:value-of select="$outputstring"/>-->
[67c3df4]1014 </xsl:otherwise>
1015 </xsl:choose>
1016 </xsl:otherwise>
1017 </xsl:choose>
1018 </xsl:template>
1019
[aeb8539]1020 <xsl:template name="remove-ampersand">
1021 <xsl:param name="out-string" select="''"/>
1022 <xsl:choose>
1023 <xsl:when test="contains($out-string,'&amp;&amp;&#xA;')">
1024 <xsl:variable name="instruction-before">
1025 <xsl:call-template name="last-line">
1026 <xsl:with-param
1027 name="instructions"
1028 select="substring-before($out-string,'&amp;&amp;&#xA;')"/>
1029 </xsl:call-template>
1030 </xsl:variable>
1031 <xsl:call-template name="remove-end-space">
1032 <xsl:with-param
1033 name="instructions"
1034 select="substring-before($out-string,'&amp;&amp;&#xA;')"/>
1035 </xsl:call-template>
1036 <xsl:if test="contains($instruction-before,' ]') or
1037 contains($instruction-before,'test ') or
1038 contains($instruction-before,'pgrep -l')">
1039 <xsl:text> &amp;&amp;</xsl:text>
1040 </xsl:if>
[619b313]1041 <xsl:text>
1042</xsl:text>
[aeb8539]1043 <xsl:call-template name="remove-ampersand">
1044 <xsl:with-param name="out-string"
1045 select="substring-after($out-string,
1046 '&amp;&amp;&#xA;')"/>
1047 </xsl:call-template>
1048 </xsl:when>
1049 <xsl:otherwise>
1050 <xsl:copy-of select="$out-string"/>
1051 </xsl:otherwise>
1052 </xsl:choose>
1053 </xsl:template>
1054
1055 <xsl:template name="last-line">
1056 <xsl:param name="instructions" select="''"/>
1057 <xsl:choose>
1058 <xsl:when test="contains($instructions,'&#xA;')">
1059 <xsl:call-template name="last-line">
1060 <xsl:with-param
1061 name="instructions"
1062 select="substring-after($instructions,'&#xA;')"/>
1063 </xsl:call-template>
1064 </xsl:when>
1065 <xsl:otherwise>
1066 <xsl:copy-of select="normalize-space($instructions)"/>
1067 </xsl:otherwise>
1068 </xsl:choose>
1069 </xsl:template>
1070
1071 <xsl:template name="remove-end-space">
1072 <xsl:param name="instructions" select="''"/>
1073 <xsl:choose>
[619b313]1074 <xsl:when
1075 test="substring($instructions,string-length($instructions))=' '">
[aeb8539]1076 <xsl:call-template name="remove-end-space">
1077 <xsl:with-param
1078 name="instructions"
[619b313]1079 select="substring($instructions,
1080 1,
1081 string-length($instructions)-1)"/>
[aeb8539]1082 </xsl:call-template>
1083 </xsl:when>
1084 <xsl:otherwise>
[619b313]1085 <xsl:copy-of select="$instructions"/>
[aeb8539]1086 </xsl:otherwise>
1087 </xsl:choose>
1088 </xsl:template>
1089
[e576789]1090</xsl:stylesheet>
Note: See TracBrowser for help on using the repository browser.