source: BLFS/xsl/scripts.xsl@ 5fd1a98

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

BLFS tools: Take variables from config instead of envars.conf

Get them in gen_pkg_book, and pass them to sripts.xsl
use them in scripts.xsl. We set them at the beginning of
of the scriptlet, so that it is easy to modify them.

  • Property mode set to 100644
File size: 38.5 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
220# End of environment</xsl:text>
221
[c048987]222 <xsl:choose>
223 <!-- Package page -->
224 <xsl:when test="sect2[@role='package']">
225 <!-- We build in a subdirectory, whose name may be needed
[9daa202]226 if using package management, so
[c048987]227 "export" it -->
[619b313]228 <xsl:text>
229export JH_PKG_DIR=</xsl:text>
[c048987]230 <xsl:value-of select="$filename"/>
231 <xsl:text>
[1fa0dee]232SRC_DIR=${JH_SRC_ARCHIVE}${JH_SRC_SUBDIRS:+/${JH_PKG_DIR}}
233BUILD_DIR=${JH_BUILD_ROOT}${JH_BUILD_SUBDIRS:+/${JH_PKG_DIR}}
[39dc04a]234mkdir -p $SRC_DIR
235mkdir -p $BUILD_DIR
236</xsl:text>
[67c3df4]237
[9daa202]238<!-- If stats are requested, include some definitions and initializations -->
[619b313]239 <xsl:if test="$want-stats">
240 <xsl:text>
241INFOLOG=$(pwd)/info-${JH_PKG_DIR}
[9e0c4b6]242TESTLOG=$(pwd)/test-${JH_PKG_DIR}
[9daa202]243echo MAKEFLAGS: $MAKEFLAGS > $INFOLOG
244echo NINJAJOBS: $NINJAJOBS >> $INFOLOG
[c048987]245: > $TESTLOG
[67c3df4]246PKG_DEST=${BUILD_DIR}/dest
247</xsl:text>
[9daa202]248<!-- in some cases, DESTDIR may have been populated by root -->
249 <xsl:if test="$sudo = 'y'">
250 <xsl:text>sudo </xsl:text>
251 </xsl:if>
252 <xsl:text>rm -rf $PKG_DEST
253</xsl:text>
254 </xsl:if><!-- want-stats -->
[c048987]255 <!-- Download code and build commands -->
[619b313]256 <xsl:apply-templates select="sect2">
257 <xsl:with-param name="want-stats" select="$want-stats"/>
258 </xsl:apply-templates>
[c048987]259 <!-- Clean-up -->
[619b313]260 <xsl:text>
261
262cd $BUILD_DIR
[1fa0dee]263[[ -n "$JH_KEEP_FILES" ]] || </xsl:text>
[c048987]264 <!-- In some case, some files in the build tree are owned
265 by root -->
266 <xsl:if test="$sudo='y'">
267 <xsl:text>sudo </xsl:text>
268 </xsl:if>
[619b313]269 <xsl:text>rm -rf $JH_UNPACKDIR unpacked
270</xsl:text>
[c048987]271 </xsl:when>
272 <!-- Non-package page -->
273 <xsl:otherwise>
274 <xsl:apply-templates select=".//screen" mode="not-pack"/>
275 </xsl:otherwise>
276 </xsl:choose>
[619b313]277 <xsl:text>
278exit
279</xsl:text><!-- include a \n at the end of document-->
[c048987]280 </exsl:document>
[e576789]281 </xsl:template>
282
283<!--======================= Sub-sections code =======================-->
284
285 <xsl:template match="sect2">
[619b313]286 <xsl:param name="want-stats" select="false"/>
[e576789]287 <xsl:choose>
[c048987]288
[e576789]289 <xsl:when test="@role = 'package'">
[619b313]290 <xsl:text>
291cd $SRC_DIR</xsl:text>
[642722f]292 <!-- Download information is in bridgehead tags -->
[e576789]293 <xsl:apply-templates select="bridgehead[@renderas='sect3']"/>
[c048987]294 </xsl:when><!-- @role="package" -->
295
[967b819]296 <xsl:when test="@role = 'qt4-prefix' or @role = 'qt5-prefix'">
[625cb14]297 <xsl:apply-templates select=".//screen[./userinput]"/>
[967b819]298 </xsl:when>
[c048987]299
[0a0b609]300 <xsl:when test="@role = 'installation' and
301 not(preceding-sibling::sect2[@role = 'installation'])">
[e576789]302 <xsl:text>
[39dc04a]303cd $BUILD_DIR
[07f7eff]304find . -maxdepth 1 -mindepth 1 -type d | xargs </xsl:text>
305 <xsl:if test="$sudo='y'">
306 <xsl:text>sudo </xsl:text>
307 </xsl:if>
308 <xsl:text>rm -rf
[67c3df4]309</xsl:text>
[619b313]310 <!-- If stats are requested, insert the start size -->
311 <xsl:if test="$want-stats">
312 <xsl:text>
[59c4761]313echo Start Size: $(sudo du -skx --exclude home $BUILD_DIR) >> $INFOLOG
[67c3df4]314</xsl:text>
315 </xsl:if>
316
[619b313]317 <xsl:text>
318case $PACKAGE in
[e6967a1]319 *.tar.gz|*.tar.bz2|*.tar.xz|*.tgz|*.tar.lzma)
[39dc04a]320 tar -xvf $SRC_DIR/$PACKAGE &gt; unpacked
[1fa0dee]321 JH_UNPACKDIR=`grep '[^./]\+' unpacked | head -n1 | sed 's@^\./@@;s@/.*@@'`
[6eaae5e]322 ;;
323 *.tar.lz)
[39dc04a]324 bsdtar -xvf $SRC_DIR/$PACKAGE 2&gt; unpacked
[1fa0dee]325 JH_UNPACKDIR=`head -n1 unpacked | cut -d" " -f2 | sed 's@^\./@@;s@/.*@@'`
[67992a0]326 ;;
327 *.zip)
[39dc04a]328 zipinfo -1 $SRC_DIR/$PACKAGE &gt; unpacked
[1fa0dee]329 JH_UNPACKDIR="$(sed 's@/.*@@' unpacked | uniq )"
330 if test $(wc -w &lt;&lt;&lt; $JH_UNPACKDIR) -eq 1; then
[39dc04a]331 unzip $SRC_DIR/$PACKAGE
[67992a0]332 else
[1fa0dee]333 JH_UNPACKDIR=${PACKAGE%.zip}
334 unzip -d $JH_UNPACKDIR $SRC_DIR/$PACKAGE
[67992a0]335 fi
336 ;;
337 *)
[1fa0dee]338 JH_UNPACKDIR=$JH_PKG_DIR-build
339 mkdir $JH_UNPACKDIR
340 cp $SRC_DIR/$PACKAGE $JH_UNPACKDIR
[619b313]341 ADDITIONAL="$(find . -mindepth 1 -maxdepth 1 -type l)"
342 if [ -n "$ADDITIONAL" ]; then
343 cp $ADDITIONAL $JH_UNPACKDIR
344 fi
[67992a0]345 ;;
346esac
[1fa0dee]347export JH_UNPACKDIR
[619b313]348cd $JH_UNPACKDIR
[67992a0]349</xsl:text>
[619b313]350 <!-- If stats are requested, insert the start time -->
351 <xsl:if test="$want-stats">
352 <xsl:text>
353echo Start Time: ${SECONDS} >> $INFOLOG
[67c3df4]354</xsl:text>
355 </xsl:if>
356
[7933ed7]357 <xsl:call-template name="process-install">
358 <xsl:with-param
359 name="instruction-tree"
[625cb14]360 select=".//screen[not(@role = 'nodump') and ./userinput] |
[c048987]361 .//para/command[contains(text(),'check') or
[7933ed7]362 contains(text(),'test')]"/>
[619b313]363 <xsl:with-param name="want-stats" select="$want-stats"/>
[7933ed7]364 <xsl:with-param name="root-seen" select="boolean(0)"/>
365 <xsl:with-param name="install-seen" select="boolean(0)"/>
366 <xsl:with-param name="test-seen" select="boolean(0)"/>
367 <xsl:with-param name="doc-seen" select="boolean(0)"/>
368 </xsl:call-template>
[619b313]369 <xsl:text>
370</xsl:text>
[e576789]371 <xsl:if test="$sudo = 'y'">
372 <xsl:text>sudo /sbin/</xsl:text>
373 </xsl:if>
[619b313]374 <xsl:text>ldconfig</xsl:text>
[c048987]375 </xsl:when><!-- @role="installation" -->
376
[e576789]377 <xsl:when test="@role = 'configuration'">
[619b313]378 <xsl:text>&#xA;</xsl:text>
[625cb14]379 <xsl:apply-templates mode="config"
380 select=".//screen[not(@role = 'nodump') and ./userinput]"/>
[c048987]381 </xsl:when><!-- @role="configuration" -->
382
[e576789]383 </xsl:choose>
384 </xsl:template>
385
386<!--==================== Download code =======================-->
387
[642722f]388 <!-- template for extracting the filename from an url in the form:
389 proto://internet.name/dir1/.../dirn/filename?condition.
390 Needed, because substring-after(...,'/') returns only the
391 substring after the first '/'. -->
[e576789]392 <xsl:template name="package_name">
393 <xsl:param name="url" select="foo"/>
394 <xsl:param name="sub-url" select="substring-after($url,'/')"/>
395 <xsl:choose>
396 <xsl:when test="contains($sub-url,'/')">
397 <xsl:call-template name="package_name">
398 <xsl:with-param name="url" select="$sub-url"/>
399 </xsl:call-template>
400 </xsl:when>
401 <xsl:otherwise>
402 <xsl:choose>
403 <xsl:when test="contains($sub-url,'?')">
404 <xsl:value-of select="substring-before($sub-url,'?')"/>
405 </xsl:when>
406 <xsl:otherwise>
407 <xsl:value-of select="$sub-url"/>
408 </xsl:otherwise>
409 </xsl:choose>
410 </xsl:otherwise>
411 </xsl:choose>
412 </xsl:template>
413
[642722f]414 <!-- Generates the code to download a package, an additional package or
415 a patch. -->
416 <xsl:template name="download-file">
417 <xsl:param name="httpurl" select="''"/>
418 <xsl:param name="ftpurl" select="''"/>
419 <xsl:param name="md5" select="''"/>
420 <xsl:param name="varname" select="''"/>
421 <xsl:variable name="package">
422 <xsl:call-template name="package_name">
423 <xsl:with-param name="url">
[e576789]424 <xsl:choose>
[642722f]425 <xsl:when test="string-length($httpurl) &gt; 10">
426 <xsl:value-of select="$httpurl"/>
[e576789]427 </xsl:when>
428 <xsl:otherwise>
[642722f]429 <xsl:value-of select="$ftpurl"/>
[e576789]430 </xsl:otherwise>
431 </xsl:choose>
[642722f]432 </xsl:with-param>
433 </xsl:call-template>
434 </xsl:variable>
435 <xsl:variable name="first_letter"
436 select="translate(substring($package,1,1),
437 'ABCDEFGHIJKLMNOPQRSTUVWXYZ',
438 'abcdefghijklmnopqrstuvwxyz')"/>
439 <xsl:text>&#xA;</xsl:text>
440 <xsl:value-of select="$varname"/>
441 <xsl:text>=</xsl:text>
442 <xsl:value-of select="$package"/>
443 <xsl:text>&#xA;if [[ ! -f $</xsl:text>
444 <xsl:value-of select="$varname"/>
[8dc4646]445 <xsl:text> ]] ; then
[9daa202]446 if [ -f "$JH_SRC_ARCHIVE/$</xsl:text>
[642722f]447 <xsl:value-of select="$varname"/>
[9daa202]448 <xsl:text>" ] ; then&#xA;</xsl:text>
449 <xsl:text> cp "$JH_SRC_ARCHIVE/$</xsl:text>
[642722f]450 <xsl:value-of select="$varname"/>
[9daa202]451 <xsl:text>" "$</xsl:text>
[642722f]452 <xsl:value-of select="$varname"/>
[9daa202]453 <xsl:text>"
[8dc4646]454 else&#xA;</xsl:text>
[342c862]455 <!-- Download from upstream http -->
[642722f]456 <xsl:if test="string-length($httpurl) &gt; 10">
[9daa202]457 <xsl:text> wget -T 30 -t 5 "</xsl:text>
[642722f]458 <xsl:value-of select="$httpurl"/>
[9daa202]459 <xsl:text>" ||&#xA;</xsl:text>
[642722f]460 </xsl:if>
[342c862]461 <!-- Download from upstream ftp -->
[642722f]462 <xsl:if test="string-length($ftpurl) &gt; 10">
[9daa202]463 <xsl:text> wget -T 30 -t 5 "</xsl:text>
[642722f]464 <xsl:value-of select="$ftpurl"/>
[9daa202]465 <xsl:text>" ||&#xA;</xsl:text>
[642722f]466 </xsl:if>
[342c862]467 <!-- The FTP_SERVER mirror as a last resort -->
[9daa202]468 <xsl:text> wget -T 30 -t 5 "${JH_FTP_SERVER}svn/</xsl:text>
[342c862]469 <xsl:value-of select="$first_letter"/>
470 <xsl:text>/$</xsl:text>
471 <xsl:value-of select="$varname"/>
[9daa202]472 <xsl:text>"
[8dc4646]473 fi
[619b313]474fi</xsl:text>
[642722f]475 <xsl:if test="string-length($md5) &gt; 10">
[619b313]476 <xsl:text>
477echo "</xsl:text>
[642722f]478 <xsl:value-of select="$md5"/>
479 <xsl:text>&#x20;&#x20;$</xsl:text>
480 <xsl:value-of select="$varname"/>
[619b313]481 <xsl:text>" | md5sum -c -</xsl:text>
[39dc04a]482 </xsl:if>
483<!-- link additional packages into $BUILD_DIR, because they are supposed to
484 be there-->
485 <xsl:if test="string($varname) != 'PACKAGE'">
[619b313]486 <xsl:text>
[9daa202]487[ "$SRC_DIR" != "$BUILD_DIR" ] &amp;&amp; ln -sf "$SRC_DIR/$</xsl:text>
[39dc04a]488 <xsl:value-of select="$varname"/>
[9daa202]489 <xsl:text>" "$BUILD_DIR"</xsl:text>
[642722f]490 </xsl:if>
[619b313]491 <xsl:text>&#xA;</xsl:text>
[642722f]492 </xsl:template>
493
494 <!-- Extract the MD5 sum information -->
495 <xsl:template match="para" mode="md5">
496 <xsl:choose>
497 <xsl:when test="contains(substring-after(string(),'sum: '),'&#xA;')">
498 <xsl:value-of select="substring-before(substring-after(string(),'sum: '),'&#xA;')"/>
[e576789]499 </xsl:when>
[642722f]500 <xsl:otherwise>
501 <xsl:value-of select="substring-after(string(),'sum: ')"/>
502 </xsl:otherwise>
[e576789]503 </xsl:choose>
504 </xsl:template>
505
[642722f]506 <!-- We have several templates itemizedlist, depending on whether we
507 expect the package information, or additional package(s) or patch(es)
508 information. Select the appropriate mode here. -->
509 <xsl:template match="bridgehead">
[e576789]510 <xsl:choose>
[642722f]511 <!-- Special case for Openjdk -->
512 <xsl:when test="contains(string(),'Source Package Information')">
513 <xsl:apply-templates
514 select="following-sibling::itemizedlist[1]//simplelist">
515 <xsl:with-param name="varname" select="'PACKAGE'"/>
516 </xsl:apply-templates>
517 <xsl:apply-templates select="following-sibling::itemizedlist
518 [preceding-sibling::bridgehead[1]=current()
519 and position() &gt;1]//simplelist">
520 <xsl:with-param name="varname" select="'PACKAGE1'"/>
521 </xsl:apply-templates>
[e576789]522 </xsl:when>
[642722f]523 <!-- Package information -->
524 <xsl:when test="contains(string(),'Package Information')">
525 <xsl:apply-templates select="following-sibling::itemizedlist
526 [preceding-sibling::bridgehead[1]=current()]"
527 mode="package"/>
[e576789]528 </xsl:when>
[642722f]529 <!-- Additional package information -->
[2873df6]530 <!-- special cases for llvm -->
[bfc99d1]531 <xsl:when test="contains(string(),'Recommended Download')">
[2873df6]532 <xsl:apply-templates select="following-sibling::itemizedlist[1]"
533 mode="additional"/>
534 </xsl:when>
[ba57e61]535 <xsl:when test="contains(string(),'Optional Download')">
536 <xsl:apply-templates select="following-sibling::itemizedlist"
537 mode="additional"/>
538 </xsl:when>
539 <!-- All other additional packages have "Additional" -->
[642722f]540 <xsl:when test="contains(string(),'Additional')">
541 <xsl:apply-templates select="following-sibling::itemizedlist"
542 mode="additional"/>
[e576789]543 </xsl:when>
[642722f]544 <!-- Do not do anything if the dev has created another type of
545 bridgehead. -->
546 <xsl:otherwise/>
[e576789]547 </xsl:choose>
548 </xsl:template>
549
[642722f]550 <!-- Call the download code template with appropriate parameters -->
551 <xsl:template match="itemizedlist" mode="package">
552 <xsl:call-template name="download-file">
553 <xsl:with-param name="httpurl">
554 <xsl:value-of select="./listitem[1]/para/ulink/@url"/>
555 </xsl:with-param>
556 <xsl:with-param name="ftpurl">
557 <xsl:value-of select="./listitem/para[contains(string(),'FTP')]/ulink/@url"/>
558 </xsl:with-param>
559 <xsl:with-param name="md5">
560 <xsl:apply-templates select="./listitem/para[contains(string(),'MD5')]"
561 mode="md5"/>
562 </xsl:with-param>
563 <xsl:with-param name="varname" select="'PACKAGE'"/>
564 </xsl:call-template>
[e576789]565 </xsl:template>
566
[642722f]567 <xsl:template match="itemizedlist" mode="additional">
568 <!-- The normal layout is "one listitem"<->"one url", but some devs
569 find amusing to have FTP and/or MD5sum listitems, or to
570 enclose the download information inside a simplelist tag... -->
571 <xsl:for-each select="listitem[.//ulink]">
572 <xsl:choose>
573 <!-- hopefully, there was a HTTP line before -->
574 <xsl:when test="contains(string(./para),'FTP')"/>
575 <xsl:when test=".//simplelist">
576 <xsl:apply-templates select=".//simplelist">
577 <xsl:with-param name="varname" select="'PACKAGE1'"/>
578 </xsl:apply-templates>
579 </xsl:when>
580 <xsl:otherwise>
581 <xsl:call-template name="download-file">
582 <xsl:with-param name="httpurl">
583 <xsl:value-of select="./para/ulink/@url"/>
584 </xsl:with-param>
585 <xsl:with-param name="ftpurl">
586 <xsl:value-of
587 select="following-sibling::listitem[1]/
588 para[contains(string(),'FTP')]/ulink/@url"/>
589 </xsl:with-param>
590 <xsl:with-param name="md5">
591 <xsl:apply-templates
592 select="following-sibling::listitem[position()&lt;3]/
593 para[contains(string(),'MD5')]"
594 mode="md5"/>
595 </xsl:with-param>
596 <xsl:with-param name="varname">
597 <xsl:choose>
598 <xsl:when test="contains(./para/ulink/@url,'.patch')">
599 <xsl:text>PATCH</xsl:text>
600 </xsl:when>
601 <xsl:otherwise>
602 <xsl:text>PACKAGE1</xsl:text>
603 </xsl:otherwise>
604 </xsl:choose>
605 </xsl:with-param>
606 </xsl:call-template>
607 </xsl:otherwise>
608 </xsl:choose>
609 </xsl:for-each>
[e576789]610 </xsl:template>
611
[642722f]612 <!-- the simplelist case. Hopefully, the layout is one member for
613 url, one for md5 and others for various information, that we do not
614 use -->
615 <xsl:template match="simplelist">
616 <xsl:param name="varname" select="'PACKAGE1'"/>
617 <xsl:call-template name="download-file">
618 <xsl:with-param name="httpurl" select=".//ulink/@url"/>
619 <xsl:with-param name="md5">
620 <xsl:value-of select="substring-after(member[contains(string(),'MD5')],'sum: ')"/>
621 </xsl:with-param>
622 <xsl:with-param name="varname" select="$varname"/>
623 </xsl:call-template>
624 </xsl:template>
[625cb14]625
626<!--====================== Non package code =========================-->
627
628 <xsl:template match="screen" mode="not-pack">
629 <xsl:choose>
[6622409]630 <xsl:when test="@role='nodump'"/>
[625cb14]631 <xsl:when test="ancestor::sect1[@id='postlfs-config-vimrc']">
632 <xsl:text>
633cat > ~/.vimrc &lt;&lt;EOF
634</xsl:text>
635 <xsl:apply-templates/>
636 <xsl:text>
637EOF
638</xsl:text>
639 </xsl:when>
640 <xsl:otherwise>
641 <xsl:apply-templates select="." mode="config"/>
642 </xsl:otherwise>
643 </xsl:choose>
644 </xsl:template>
[e576789]645<!--======================== Commands code ==========================-->
[c048987]646<!-- Code for installation instructions is in gen-install.xsl -->
[e576789]647
648 <xsl:template match="screen">
[c048987]649 <xsl:choose>
650<!-- instructions run as root (configuration mainly) -->
651 <xsl:when test="@role = 'root'">
[aeb8539]652<!-- templates begin/end-root are in gen-install.xsl -->
[c048987]653 <xsl:if test="not(preceding-sibling::screen[1][@role='root'])">
[aeb8539]654 <xsl:call-template name="begin-root"/>
[c048987]655 </xsl:if>
656 <xsl:apply-templates mode="root"/>
657 <xsl:if test="not(following-sibling::screen[1][@role='root'])">
[aeb8539]658 <xsl:call-template name="end-root"/>
[c048987]659 </xsl:if>
660 </xsl:when>
[67c3df4]661<!-- then all the instructions run as user -->
[c048987]662 <xsl:otherwise>
663 <xsl:apply-templates select="userinput"/>
664 </xsl:otherwise>
665 </xsl:choose>
[e576789]666 </xsl:template>
667
[8fc6a47]668<!-- Templates for bootscripts/units installation -->
[70d73d1]669 <xsl:template name="set-bootpkg-dir">
670 <xsl:param name="bootpkg" select="'bootscripts'"/>
671 <xsl:param name="url" select="''"/>
[619b313]672 <xsl:text>
673BOOTPKG_DIR=blfs-</xsl:text>
[70d73d1]674 <xsl:copy-of select="$bootpkg"/>
675 <xsl:text>
[619b313]676
[1fa0dee]677BOOTSRC_DIR=${JH_SRC_ARCHIVE}${JH_SRC_SUBDIRS:+/${BOOTPKG_DIR}}
678BOOTBUILD_DIR=${JH_BUILD_ROOT}${JH_BUILD_SUBDIRS:+/${BOOTPKG_DIR}}
[973c767]679mkdir -p $BOOTSRC_DIR
680mkdir -p $BOOTBUILD_DIR
681
682pushd $BOOTSRC_DIR
[e576789]683URL=</xsl:text>
[70d73d1]684 <xsl:value-of select="$url"/>
685 <xsl:text>
[e576789]686BOOTPACKG=$(basename $URL)
[bbcdeab]687if [[ ! -f $BOOTPACKG ]] ; then
[1fa0dee]688 if [[ -f $JH_SRC_ARCHIVE/$BOOTPACKG ]] ; then
689 cp $JH_SRC_ARCHIVE/$BOOTPACKG $BOOTPACKG
[bbcdeab]690 else
691 wget -T 30 -t 5 $URL
692 fi
[973c767]693 rm -f $BOOTBUILD_DIR/unpacked
[bbcdeab]694fi
695
[973c767]696cd $BOOTBUILD_DIR
[e576789]697if [[ -e unpacked ]] ; then
[f079f8f]698 BOOTUNPACKDIR=`head -n1 unpacked | sed 's@^./@@;s@/.*@@'`
699 if ! [[ -d $BOOTUNPACKDIR ]]; then
[973c767]700 tar -xvf $BOOTSRC_DIR/$BOOTPACKG > unpacked
[f079f8f]701 BOOTUNPACKDIR=`head -n1 unpacked | sed 's@^./@@;s@/.*@@'`
[e576789]702 fi
703else
[973c767]704 tar -xvf $BOOTSRC_DIR/$BOOTPACKG > unpacked
[f079f8f]705 BOOTUNPACKDIR=`head -n1 unpacked | sed 's@^./@@;s@/.*@@'`
[e576789]706fi
[619b313]707cd $BOOTUNPACKDIR</xsl:text>
[70d73d1]708 </xsl:template>
709
710 <xsl:template match="screen" mode="config">
711 <xsl:if test="preceding-sibling::para[1]/xref[@linkend='bootscripts']">
[aeb8539]712<!-- if the preceding "screen" tag is role="root", and we are role="root"
713 the end-root has not been called. So do it -->
[619b313]714 <xsl:if
715 test="preceding-sibling::screen[1][@role='root'] and @role='root'">
[aeb8539]716 <xsl:call-template name="end-root"/>
717 </xsl:if>
[70d73d1]718 <xsl:call-template name="set-bootpkg-dir">
719 <xsl:with-param name="bootpkg" select="'bootscripts'"/>
720 <xsl:with-param name="url"
721 select="id('bootscripts')//itemizedlist//ulink/@url"/>
722 </xsl:call-template>
[aeb8539]723<!-- if the preceding "screen" tag is role="root", and we are role="root"
724 the begin-root will not be called. So do it -->
[619b313]725 <xsl:if
726 test="preceding-sibling::screen[1][@role='root'] and @role='root'">
[aeb8539]727 <xsl:call-template name="begin-root"/>
728 </xsl:if>
[70d73d1]729 </xsl:if>
730 <xsl:if test="preceding-sibling::para[1]/xref[@linkend='systemd-units']">
[aeb8539]731<!-- if the preceding "screen" tag is role="root", and we are role="root"
732 the end-root has not been called. So do it -->
[619b313]733 <xsl:if
734 test="preceding-sibling::screen[1][@role='root'] and @role='root'">
[aeb8539]735 <xsl:call-template name="end-root"/>
736 </xsl:if>
[70d73d1]737 <xsl:call-template name="set-bootpkg-dir">
738 <xsl:with-param name="bootpkg" select="'systemd-units'"/>
739 <xsl:with-param name="url"
740 select="id('systemd-units')//itemizedlist//ulink/@url"/>
741 </xsl:call-template>
[aeb8539]742<!-- if the preceding "screen" tag is role="root", and we are role="root"
743 the begin-root will not be called. So do it -->
[619b313]744 <xsl:if
745 test="preceding-sibling::screen[1][@role='root'] and @role='root'">
[aeb8539]746 <xsl:call-template name="begin-root"/>
747 </xsl:if>
[e576789]748 </xsl:if>
749 <xsl:apply-templates select='.'/>
[70d73d1]750 <xsl:if test="preceding-sibling::para[1]/xref[@linkend='bootscripts' or
751 @linkend='systemd-units']">
[aeb8539]752<!-- if the next "screen" tag is role="root", and we are role="root"
753 the end-root has not been called. So do it -->
[619b313]754 <xsl:if
755 test="following-sibling::screen[1][@role='root'] and @role='root'">
[aeb8539]756 <xsl:call-template name="end-root"/>
757 </xsl:if>
[619b313]758 <xsl:text>
759popd</xsl:text>
[aeb8539]760<!-- if the next "screen" tag is role="root", and we are role="root"
761 the begin-root will not be called. So do it -->
[619b313]762 <xsl:if
763 test="following-sibling::screen[1][@role='root'] and @role='root'">
[aeb8539]764 <xsl:call-template name="begin-root"/>
765 </xsl:if>
[e576789]766 </xsl:if>
767 </xsl:template>
768
[c048987]769 <xsl:template match="command" mode="installation">
[619b313]770 <xsl:param name="want-stats" select="false"/>
[a743e57]771 <xsl:variable name="ns" select="normalize-space(string())"/>
[c048987]772 <xsl:variable name="first"
773 select="not(
774 boolean(
775 preceding-sibling::command[contains(text(),'check') or
776 contains(text(),'test')]))"/>
777 <xsl:variable name="last"
778 select="not(
779 boolean(
780 following-sibling::command[contains(text(),'check') or
781 contains(text(),'test')]))"/>
782 <xsl:choose>
[619b313]783 <xsl:when test="$want-stats">
[c048987]784 <xsl:if test="$first">
[67c3df4]785 <xsl:text>
[619b313]786
[67c3df4]787echo Time after make: ${SECONDS} >> $INFOLOG
[59c4761]788echo Size after make: $(sudo du -skx --exclude home $BUILD_DIR) >> $INFOLOG
[67c3df4]789echo Time before test: ${SECONDS} >> $INFOLOG
[c048987]790
[67c3df4]791</xsl:text>
[c048987]792 </xsl:if>
793 </xsl:when>
794 <xsl:otherwise>
[619b313]795 <xsl:text>
796#</xsl:text>
[c048987]797 </xsl:otherwise>
798 </xsl:choose>
799 <xsl:choose>
800 <xsl:when test="contains($ns,'make')">
801 <xsl:value-of select="substring-before($ns,'make ')"/>
802 <xsl:text>make </xsl:text>
803 <xsl:if test="not(contains($ns,'-k'))">
804 <xsl:text>-k </xsl:text>
805 </xsl:if>
806 <xsl:value-of select="substring-after($ns,'make ')"/>
807 </xsl:when>
808 <xsl:otherwise>
809 <xsl:copy-of select="$ns"/>
810 </xsl:otherwise>
811 </xsl:choose>
[619b313]812 <xsl:if test="$want-stats">
[c048987]813 <xsl:text> &gt;&gt; $TESTLOG 2&gt;&amp;1</xsl:text>
[e576789]814 </xsl:if>
[619b313]815 <xsl:text> || true</xsl:text>
816 <xsl:if test="$want-stats">
[c048987]817 <xsl:text>
[619b313]818
[c048987]819echo Time after test: ${SECONDS} >> $INFOLOG
[59c4761]820echo Size after test: $(sudo du -skx --exclude home $BUILD_DIR) >> $INFOLOG
[c048987]821echo Time before install: ${SECONDS} >> $INFOLOG
822</xsl:text>
823 </xsl:if>
[e576789]824 </xsl:template>
825
[8fc6a47]826 <xsl:template match="userinput|command">
[619b313]827 <xsl:text>
828</xsl:text>
[e576789]829 <xsl:apply-templates/>
830 </xsl:template>
831
[619b313]832 <xsl:template match="userinput" mode="root">
833 <xsl:text>
834</xsl:text>
835 <xsl:apply-templates mode="root"/>
836 </xsl:template>
837
[aeb8539]838 <xsl:template match="text()">
839 <xsl:call-template name="remove-ampersand">
840 <xsl:with-param name="out-string" select="string()"/>
841 </xsl:call-template>
842 </xsl:template>
843
[e576789]844 <xsl:template match="text()" mode="root">
845 <xsl:call-template name="output-root">
846 <xsl:with-param name="out-string" select="string()"/>
847 </xsl:call-template>
848 </xsl:template>
849
850 <xsl:template name="output-root">
851 <xsl:param name="out-string" select="''"/>
852 <xsl:choose>
853 <xsl:when test="contains($out-string,'$') and $sudo = 'y'">
854 <xsl:call-template name="output-root">
855 <xsl:with-param name="out-string"
856 select="substring-before($out-string,'$')"/>
857 </xsl:call-template>
858 <xsl:text>\$</xsl:text>
859 <xsl:call-template name="output-root">
860 <xsl:with-param name="out-string"
861 select="substring-after($out-string,'$')"/>
862 </xsl:call-template>
863 </xsl:when>
864 <xsl:when test="contains($out-string,'`') and $sudo = 'y'">
865 <xsl:call-template name="output-root">
866 <xsl:with-param name="out-string"
867 select="substring-before($out-string,'`')"/>
868 </xsl:call-template>
869 <xsl:text>\`</xsl:text>
870 <xsl:call-template name="output-root">
871 <xsl:with-param name="out-string"
872 select="substring-after($out-string,'`')"/>
873 </xsl:call-template>
874 </xsl:when>
875 <xsl:when test="contains($out-string,'\') and $sudo = 'y'">
876 <xsl:call-template name="output-root">
877 <xsl:with-param name="out-string"
878 select="substring-before($out-string,'\')"/>
879 </xsl:call-template>
880 <xsl:text>\\</xsl:text>
881 <xsl:call-template name="output-root">
882 <xsl:with-param name="out-string"
883 select="substring-after($out-string,'\')"/>
884 </xsl:call-template>
885 </xsl:when>
886 <xsl:otherwise>
[aeb8539]887 <xsl:call-template name="remove-ampersand">
888 <xsl:with-param name="out-string" select="$out-string"/>
889 </xsl:call-template>
890<!-- <xsl:value-of select="$out-string"/> -->
[e576789]891 </xsl:otherwise>
892 </xsl:choose>
893 </xsl:template>
894
[67c3df4]895 <xsl:template name="output-destdir">
896 <xsl:apply-templates
897 select="userinput|following-sibling::screen[@role='root']/userinput"
898 mode="destdir"/>
899 <xsl:text>
[619b313]900
[67c3df4]901echo Time after install: ${SECONDS} >> $INFOLOG
[59c4761]902echo Size after install: $(sudo du -skx --exclude home $BUILD_DIR) >> $INFOLOG
[67c3df4]903</xsl:text>
904 </xsl:template>
905
906 <xsl:template match="userinput" mode="destdir">
[8fc6a47]907 <xsl:text>
908</xsl:text>
[67c3df4]909 <xsl:choose>
910 <xsl:when test="./literal">
911 <xsl:call-template name="outputpkgdest">
912 <xsl:with-param name="outputstring" select="text()[1]"/>
913 </xsl:call-template>
914 <xsl:apply-templates select="literal"/>
915 <xsl:call-template name="outputpkgdest">
916 <xsl:with-param name="outputstring" select="text()[2]"/>
917 </xsl:call-template>
918 </xsl:when>
919 <xsl:otherwise>
920 <xsl:call-template name="outputpkgdest">
921 <xsl:with-param name="outputstring" select="string()"/>
922 </xsl:call-template>
923 </xsl:otherwise>
924 </xsl:choose>
925 </xsl:template>
926
927 <xsl:template name="outputpkgdest">
928 <xsl:param name="outputstring" select="'foo'"/>
929 <xsl:choose>
930 <xsl:when test="contains($outputstring,'make ')">
931 <xsl:choose>
932 <xsl:when test="not(starts-with($outputstring,'make'))">
933 <xsl:call-template name="outputpkgdest">
934 <xsl:with-param name="outputstring"
935 select="substring-before($outputstring,'make')"/>
936 </xsl:call-template>
937 <xsl:call-template name="outputpkgdest">
938 <xsl:with-param
939 name="outputstring"
940 select="substring-after($outputstring,
941 substring-before($outputstring,'make'))"/>
942 </xsl:call-template>
943 </xsl:when>
944 <xsl:otherwise>
[619b313]945 <xsl:text>
946make DESTDIR=$PKG_DEST</xsl:text>
[67c3df4]947 <xsl:call-template name="outputpkgdest">
948 <xsl:with-param
949 name="outputstring"
950 select="substring-after($outputstring,'make')"/>
951 </xsl:call-template>
952 </xsl:otherwise>
953 </xsl:choose>
954 </xsl:when>
955 <xsl:when test="contains($outputstring,'ninja install')">
956 <xsl:choose>
957 <xsl:when test="not(starts-with($outputstring,'ninja install'))">
958 <xsl:call-template name="outputpkgdest">
959 <xsl:with-param name="outputstring"
960 select="substring-before($outputstring,'ninja install')"/>
961 </xsl:call-template>
962 <xsl:call-template name="outputpkgdest">
963 <xsl:with-param
964 name="outputstring"
965 select="substring-after($outputstring,
966 substring-before($outputstring,'ninja install'))"/>
967 </xsl:call-template>
968 </xsl:when>
969 <xsl:otherwise>
[619b313]970 <xsl:text>
971DESTDIR=$PKG_DEST ninja</xsl:text>
[67c3df4]972 <xsl:call-template name="outputpkgdest">
973 <xsl:with-param
974 name="outputstring"
975 select="substring-after($outputstring,'ninja')"/>
976 </xsl:call-template>
977 </xsl:otherwise>
978 </xsl:choose>
979 </xsl:when>
980 <xsl:otherwise> <!-- no make nor ninja in this string -->
981 <xsl:choose>
982 <xsl:when test="contains($outputstring,'&gt;/') and
983 not(contains(substring-before($outputstring,'&gt;/'),' /'))">
[aeb8539]984 <xsl:call-template name="remove-ampersand">
985 <xsl:with-param name="out-string"
986 select="substring-before($outputstring,'&gt;/')"/>
987 </xsl:call-template>
988<!-- <xsl:value-of select="substring-before($outputstring,'&gt;/')"/>-->
[67c3df4]989 <xsl:text>&gt;$PKG_DEST/</xsl:text>
990 <xsl:call-template name="outputpkgdest">
991 <xsl:with-param name="outputstring" select="substring-after($outputstring,'&gt;/')"/>
992 </xsl:call-template>
993 </xsl:when>
994 <xsl:when test="contains($outputstring,' /')">
[aeb8539]995 <xsl:call-template name="remove-ampersand">
996 <xsl:with-param name="out-string"
997 select="substring-before($outputstring,' /')"/>
998 </xsl:call-template>
999<!-- <xsl:value-of select="substring-before($outputstring,' /')"/>-->
[67c3df4]1000 <xsl:text> $PKG_DEST/</xsl:text>
1001 <xsl:call-template name="outputpkgdest">
1002 <xsl:with-param name="outputstring" select="substring-after($outputstring,' /')"/>
1003 </xsl:call-template>
1004 </xsl:when>
1005 <xsl:otherwise>
[aeb8539]1006 <xsl:call-template name="remove-ampersand">
1007 <xsl:with-param name="out-string" select="$outputstring"/>
1008 </xsl:call-template>
1009<!-- <xsl:value-of select="$outputstring"/>-->
[67c3df4]1010 </xsl:otherwise>
1011 </xsl:choose>
1012 </xsl:otherwise>
1013 </xsl:choose>
1014 </xsl:template>
1015
[aeb8539]1016 <xsl:template name="remove-ampersand">
1017 <xsl:param name="out-string" select="''"/>
1018 <xsl:choose>
1019 <xsl:when test="contains($out-string,'&amp;&amp;&#xA;')">
1020 <xsl:variable name="instruction-before">
1021 <xsl:call-template name="last-line">
1022 <xsl:with-param
1023 name="instructions"
1024 select="substring-before($out-string,'&amp;&amp;&#xA;')"/>
1025 </xsl:call-template>
1026 </xsl:variable>
1027 <xsl:call-template name="remove-end-space">
1028 <xsl:with-param
1029 name="instructions"
1030 select="substring-before($out-string,'&amp;&amp;&#xA;')"/>
1031 </xsl:call-template>
1032 <xsl:if test="contains($instruction-before,' ]') or
1033 contains($instruction-before,'test ') or
1034 contains($instruction-before,'pgrep -l')">
1035 <xsl:text> &amp;&amp;</xsl:text>
1036 </xsl:if>
[619b313]1037 <xsl:text>
1038</xsl:text>
[aeb8539]1039 <xsl:call-template name="remove-ampersand">
1040 <xsl:with-param name="out-string"
1041 select="substring-after($out-string,
1042 '&amp;&amp;&#xA;')"/>
1043 </xsl:call-template>
1044 </xsl:when>
1045 <xsl:otherwise>
1046 <xsl:copy-of select="$out-string"/>
1047 </xsl:otherwise>
1048 </xsl:choose>
1049 </xsl:template>
1050
1051 <xsl:template name="last-line">
1052 <xsl:param name="instructions" select="''"/>
1053 <xsl:choose>
1054 <xsl:when test="contains($instructions,'&#xA;')">
1055 <xsl:call-template name="last-line">
1056 <xsl:with-param
1057 name="instructions"
1058 select="substring-after($instructions,'&#xA;')"/>
1059 </xsl:call-template>
1060 </xsl:when>
1061 <xsl:otherwise>
1062 <xsl:copy-of select="normalize-space($instructions)"/>
1063 </xsl:otherwise>
1064 </xsl:choose>
1065 </xsl:template>
1066
1067 <xsl:template name="remove-end-space">
1068 <xsl:param name="instructions" select="''"/>
1069 <xsl:choose>
[619b313]1070 <xsl:when
1071 test="substring($instructions,string-length($instructions))=' '">
[aeb8539]1072 <xsl:call-template name="remove-end-space">
1073 <xsl:with-param
1074 name="instructions"
[619b313]1075 select="substring($instructions,
1076 1,
1077 string-length($instructions)-1)"/>
[aeb8539]1078 </xsl:call-template>
1079 </xsl:when>
1080 <xsl:otherwise>
[619b313]1081 <xsl:copy-of select="$instructions"/>
[aeb8539]1082 </xsl:otherwise>
1083 </xsl:choose>
1084 </xsl:template>
1085
[e576789]1086</xsl:stylesheet>
Note: See TracBrowser for help on using the repository browser.