source: dump-commands.xsl@ d310939

0.2 1.0 2.3 2.3.x 2.4 ablfs ablfs-more legacy new_features trunk
Last change on this file since d310939 was d310939, checked in by Manuel Canales Esparcia <manuel@…>, 19 years ago

Making the packages dowload and testsuites run optional.
Added a switch to desactivate the automatic run of make.
Fixed some oustanding bugs and chapter05 issues.

  • Property mode set to 100644
File size: 3.8 KB
Line 
1<?xml version="1.0"?>
2<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
3 xmlns:exsl="http://exslt.org/common"
4 extension-element-prefixes="exsl"
5 version="1.0">
6
7<!-- XSLT stylesheet to create shell scripts from LFS books. -->
8
9 <xsl:param name="testsuite" select="0"/>
10
11 <xsl:template match="/">
12 <xsl:apply-templates select="//sect1"/>
13 </xsl:template>
14
15 <xsl:template match="sect1">
16 <xsl:if test="count(descendant::screen/userinput) &gt; 0 and
17 count(descendant::screen/userinput) &gt; count(descendant::screen[@role='nodump'])">
18 <!-- The dirs names -->
19 <xsl:variable name="pi-dir" select="../processing-instruction('dbhtml')"/>
20 <xsl:variable name="pi-dir-value" select="substring-after($pi-dir,'dir=')"/>
21 <xsl:variable name="quote-dir" select="substring($pi-dir-value,1,1)"/>
22 <xsl:variable name="dirname" select="substring-before(substring($pi-dir-value,2),$quote-dir)"/>
23 <!-- The file names -->
24 <xsl:variable name="pi-file" select="processing-instruction('dbhtml')"/>
25 <xsl:variable name="pi-file-value" select="substring-after($pi-file,'filename=')"/>
26 <xsl:variable name="filename" select="substring-before(substring($pi-file-value,2),'.html')"/>
27 <!-- The build order -->
28 <xsl:variable name="position" select="position()"/>
29 <xsl:variable name="order">
30 <xsl:choose>
31 <xsl:when test="string-length($position) = 1">
32 <xsl:text>00</xsl:text>
33 <xsl:value-of select="$position"/>
34 </xsl:when>
35 <xsl:when test="string-length($position) = 2">
36 <xsl:text>0</xsl:text>
37 <xsl:value-of select="$position"/>
38 </xsl:when>
39 <xsl:otherwise>
40 <xsl:value-of select="$position"/>
41 </xsl:otherwise>
42 </xsl:choose>
43 </xsl:variable>
44 <!-- Creating dirs and files -->
45 <exsl:document href="{$dirname}/{$order}-{$filename}" method="text">
46 <xsl:text>#!/bin/sh&#xA;&#xA;</xsl:text>
47 <xsl:if test="(sect2[@role='installation'] or
48 @id='ch-tools-adjusting') and
49 ancestor::chapter[@id='chapter-temporary-tools']">
50 <xsl:text>cd $PKGDIR &amp;&amp;&#xA;</xsl:text>
51 </xsl:if>
52 <xsl:apply-templates select=".//para/userinput | .//screen"/>
53 </exsl:document>
54 </xsl:if>
55 </xsl:template>
56
57 <xsl:template match="screen">
58 <xsl:if test="child::* = userinput">
59 <xsl:choose>
60 <xsl:when test="@role = 'nodump'"/>
61 <xsl:otherwise>
62 <xsl:apply-templates select="userinput" mode="screen"/>
63 <xsl:if test="position() != last() and
64 not(contains(string(),'EOF')) and
65 not(contains(string(),'check')) and
66 not(ancestor::sect1[@id='ch-tools-stripping'])">
67 <xsl:text> &amp;&amp;</xsl:text>
68 </xsl:if>
69 <xsl:text>&#xA;</xsl:text>
70 </xsl:otherwise>
71 </xsl:choose>
72 </xsl:if>
73 </xsl:template>
74
75 <xsl:template match="para/userinput">
76 <xsl:if test="$testsuite != '0' and (contains(string(),'test') or
77 contains(string(),'check'))">
78 <xsl:value-of select="substring-before(string(),'make')"/>
79 <xsl:text>make -k</xsl:text>
80 <xsl:value-of select="substring-after(string(),'make')"/>
81 <xsl:text> &#xA;</xsl:text>
82 </xsl:if>
83 </xsl:template>
84
85 <xsl:template match="userinput" mode="screen">
86 <xsl:choose>
87 <xsl:when test="string() = 'make check'">
88 <xsl:text>make -k check</xsl:text>
89 </xsl:when>
90 <xsl:otherwise>
91 <xsl:apply-templates/>
92 </xsl:otherwise>
93 </xsl:choose>
94 </xsl:template>
95
96 <xsl:template match="replaceable">
97 <xsl:text>**EDITME</xsl:text>
98 <xsl:apply-templates/>
99 <xsl:text>EDITME**</xsl:text>
100 </xsl:template>
101
102</xsl:stylesheet>
Note: See TracBrowser for help on using the repository browser.