source: CLFS2/clfs2.xsl@ 05d1b17

2.3 2.3.x 2.4 ablfs ablfs-more legacy new_features trunk
Last change on this file since 05d1b17 was 401f81e, checked in by Manuel Canales Esparcia <manuel@…>, 18 years ago

Ported Makefile clean-up and 0/1 to n/y migration code from experimental.
There is no obvious bugs, let users to find hidden bugs.

  • Property mode set to 100644
File size: 6.0 KB
Line 
1<?xml version="1.0"?>
2<!DOCTYPE xsl:stylesheet [
3 <!ENTITY % general-entities SYSTEM "FAKEDIR/general.ent">
4 %general-entities;
5]>
6
7<!-- $Id$ -->
8
9<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
10 xmlns:exsl="http://exslt.org/common"
11 extension-element-prefixes="exsl"
12 version="1.0">
13
14<!-- XSLT stylesheet to create shell scripts from CLFS2 books. -->
15
16 <!-- Compile the keymap into the kernel? -->
17 <xsl:param name="keymap" select="none"/>
18
19 <!-- Install vim-lang package? -->
20 <xsl:param name="vim-lang" select="y"/>
21
22 <!-- Time zone -->
23 <xsl:param name="timezone" select="GMT"/>
24
25 <!-- Page size -->
26 <xsl:param name="page" select="letter"/>
27
28 <!-- Locale settings -->
29 <xsl:param name="lang" select="C"/>
30
31 <xsl:template match="/">
32 <xsl:apply-templates select="//sect1"/>
33 </xsl:template>
34
35 <xsl:template match="sect1">
36 <xsl:choose>
37 <xsl:when test="../@id='chapter-partitioning' or
38 ../@id='chapter-getting-materials' or
39 ../@id='chapter-final-preps'"/>
40 <xsl:otherwise>
41 <xsl:if test="count(descendant::screen/userinput) &gt; 0 and
42 count(descendant::screen/userinput) &gt;
43 count(descendant::screen[@role='nodump'])">
44 <!-- The dirs names -->
45 <xsl:variable name="pi-dir" select="../processing-instruction('dbhtml')"/>
46 <xsl:variable name="pi-dir-value" select="substring-after($pi-dir,'dir=')"/>
47 <xsl:variable name="quote-dir" select="substring($pi-dir-value,1,1)"/>
48 <xsl:variable name="dirname" select="substring-before(substring($pi-dir-value,2),$quote-dir)"/>
49 <!-- The file names -->
50 <xsl:variable name="pi-file" select="processing-instruction('dbhtml')"/>
51 <xsl:variable name="pi-file-value" select="substring-after($pi-file,'filename=')"/>
52 <xsl:variable name="filename" select="substring-before(substring($pi-file-value,2),'.html')"/>
53 <!-- The build order -->
54 <xsl:variable name="position" select="position()"/>
55 <xsl:variable name="order">
56 <xsl:choose>
57 <xsl:when test="string-length($position) = 1">
58 <xsl:text>00</xsl:text>
59 <xsl:value-of select="$position"/>
60 </xsl:when>
61 <xsl:when test="string-length($position) = 2">
62 <xsl:text>0</xsl:text>
63 <xsl:value-of select="$position"/>
64 </xsl:when>
65 <xsl:otherwise>
66 <xsl:value-of select="$position"/>
67 </xsl:otherwise>
68 </xsl:choose>
69 </xsl:variable>
70 <!-- Creating dirs and files -->
71 <exsl:document href="{$dirname}/{$order}-{$filename}" method="text">
72 <xsl:text>#!/bin/sh&#xA;</xsl:text>
73 <xsl:if test="not(@id='ch-system-stripping')">
74 <xsl:text>set -e&#xA;&#xA;</xsl:text>
75 </xsl:if>
76 <xsl:if test="sect2[@role='installation']">
77 <xsl:text>cd $PKGDIR&#xA;</xsl:text>
78 <xsl:if test="@id='ch-system-vim' and $vim-lang = 'y'">
79 <xsl:text>tar -xvf ../vim-&vim-version;-lang.* --strip-components=1&#xA;</xsl:text>
80 </xsl:if>
81 </xsl:if>
82 <xsl:apply-templates select=".//para/userinput | .//screen"/>
83 <xsl:text>exit</xsl:text>
84 </exsl:document>
85 </xsl:if>
86 </xsl:otherwise>
87 </xsl:choose>
88 </xsl:template>
89
90 <xsl:template match="screen">
91 <xsl:if test="child::* = userinput and not(@role = 'nodump')">
92 <xsl:apply-templates select="userinput" mode="screen"/>
93 </xsl:if>
94 </xsl:template>
95
96 <xsl:template match="para/userinput"/>
97
98 <xsl:template match="userinput" mode="screen">
99 <xsl:choose>
100 <!-- Estandarized package formats -->
101 <xsl:when test="contains(string(),'tar.gz')">
102 <xsl:value-of select="substring-before(string(),'tar.gz')"/>
103 <xsl:text>tar.*</xsl:text>
104 <xsl:value-of select="substring-after(string(),'tar.gz')"/>
105 <xsl:text>&#xA;</xsl:text>
106 </xsl:when>
107 <!-- Setting $LANG for /etc/profile -->
108 <xsl:when test="ancestor::sect1[@id='ch-scripts-profile'] and
109 contains(string(),'export LANG=')">
110 <xsl:value-of select="substring-before(string(),'export LANG=')"/>
111 <xsl:text>export LANG=</xsl:text>
112 <xsl:value-of select="$lang"/>
113 <xsl:value-of select="substring-after(string(),'charmap]')"/>
114 <xsl:text>&#xA;</xsl:text>
115 </xsl:when>
116 <!-- Compile the keymap into the kernel? -->
117 <xsl:when test="contains(string(),'defkeymap') and
118 $keymap = 'none'"/>
119 <!-- Copying the kernel config file -->
120 <xsl:when test="string() = 'make mrproper'">
121 <xsl:text>make mrproper&#xA;</xsl:text>
122 <xsl:text>cp -v ../kernel-config .config&#xA;</xsl:text>
123 </xsl:when>
124 <!-- No interactive commands are needed if the .config file is the proper one -->
125 <xsl:when test="contains(string(),'menuconfig')"/>
126 <!-- Don't stop on strip run -->
127 <xsl:when test="contains(string(),'strip ')">
128 <xsl:apply-templates/>
129 <xsl:text> || true&#xA;</xsl:text>
130 </xsl:when>
131 <!-- The rest of commands -->
132 <xsl:otherwise>
133 <xsl:apply-templates/>
134 <xsl:text>&#xA;</xsl:text>
135 </xsl:otherwise>
136 </xsl:choose>
137 </xsl:template>
138
139 <xsl:template match="replaceable">
140 <xsl:choose>
141 <xsl:when test="ancestor::sect1[@id='ch-cross-tools-glibc']">
142 <xsl:value-of select="$timezone"/>
143 </xsl:when>
144 <xsl:when test="ancestor::sect1[@id='ch-cross-tools-groff'] or
145 ancestor::sect1[@id='ch-system-groff']">
146 <xsl:value-of select="$page"/>
147 </xsl:when>
148 <xsl:when test="ancestor::sect1[@id='ch-bootable-kernel']">
149 <xsl:value-of select="$keymap"/>
150 </xsl:when>
151 <xsl:otherwise>
152 <xsl:text>**EDITME</xsl:text>
153 <xsl:apply-templates/>
154 <xsl:text>EDITME**</xsl:text>
155 </xsl:otherwise>
156 </xsl:choose>
157 </xsl:template>
158
159</xsl:stylesheet>
Note: See TracBrowser for help on using the repository browser.