source: CLFS3/clfs3.xsl@ a8ceefc

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

CLFS3 don't have a stripping page.

  • Property mode set to 100644
File size: 5.8 KB
RevLine 
[837797e]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 <!-- Install vim-lang package? -->
17 <xsl:param name="vim-lang" select="y"/>
18
19 <!-- Time zone -->
20 <xsl:param name="timezone" select="GMT"/>
21
22 <!-- Page size -->
23 <xsl:param name="page" select="letter"/>
24
25 <!-- Locale settings -->
26 <xsl:param name="lang" select="C"/>
27
28 <xsl:template match="/">
29 <xsl:apply-templates select="//sect1"/>
30 </xsl:template>
31
32 <xsl:template match="sect1">
33 <xsl:choose>
34 <xsl:when test="../@id='chapter-partitioning' or
35 ../@id='chapter-getting-materials' or
36 ../@id='chapter-final-preps'"/>
37 <xsl:otherwise>
38 <xsl:if test="count(descendant::screen/userinput) &gt; 0 and
39 count(descendant::screen/userinput) &gt;
40 count(descendant::screen[@role='nodump'])">
41 <!-- The dirs names -->
42 <xsl:variable name="pi-dir" select="../processing-instruction('dbhtml')"/>
43 <xsl:variable name="pi-dir-value" select="substring-after($pi-dir,'dir=')"/>
44 <xsl:variable name="quote-dir" select="substring($pi-dir-value,1,1)"/>
45 <xsl:variable name="dirname" select="substring-before(substring($pi-dir-value,2),$quote-dir)"/>
46 <!-- The file names -->
47 <xsl:variable name="pi-file" select="processing-instruction('dbhtml')"/>
48 <xsl:variable name="pi-file-value" select="substring-after($pi-file,'filename=')"/>
49 <xsl:variable name="filename" select="substring-before(substring($pi-file-value,2),'.html')"/>
50 <!-- The build order -->
51 <xsl:variable name="position" select="position()"/>
52 <xsl:variable name="order">
53 <xsl:choose>
54 <xsl:when test="string-length($position) = 1">
55 <xsl:text>00</xsl:text>
56 <xsl:value-of select="$position"/>
57 </xsl:when>
58 <xsl:when test="string-length($position) = 2">
59 <xsl:text>0</xsl:text>
60 <xsl:value-of select="$position"/>
61 </xsl:when>
62 <xsl:otherwise>
63 <xsl:value-of select="$position"/>
64 </xsl:otherwise>
65 </xsl:choose>
66 </xsl:variable>
67 <!-- Creating dirs and files -->
68 <exsl:document href="{$dirname}/{$order}-{$filename}" method="text">
[b230bd6]69 <xsl:text>#!/bin/bash&#xA;set +h&#xA;set -e&#xA;&#xA;</xsl:text>
[2512414]70 <!-- Set envars needed by uClibc -->
71 <xsl:if test="@id='ch-cross-tools-uclibc'">
72 <xsl:copy-of select="//sect1[@id='ch-cross-tools-toolchain']/screen"/>
73 <xsl:text>&#xA;&#xA;</xsl:text>
74 </xsl:if>
[837797e]75 <xsl:if test="sect2[@role='installation']">
76 <xsl:text>cd $PKGDIR&#xA;</xsl:text>
77 </xsl:if>
78 <xsl:apply-templates select=".//para/userinput | .//screen"/>
79 <xsl:text>exit</xsl:text>
80 </exsl:document>
81 </xsl:if>
82 </xsl:otherwise>
83 </xsl:choose>
84 </xsl:template>
85
86 <xsl:template match="screen">
87 <xsl:if test="child::* = userinput and not(@role = 'nodump')">
88 <xsl:apply-templates select="userinput" mode="screen"/>
89 </xsl:if>
90 </xsl:template>
91
92 <xsl:template match="para/userinput"/>
93
94 <xsl:template match="userinput" mode="screen">
95 <xsl:choose>
96 <!-- Estandarized package formats -->
97 <xsl:when test="contains(string(),'tar.gz')">
98 <xsl:value-of select="substring-before(string(),'tar.gz')"/>
99 <xsl:text>tar.*</xsl:text>
100 <xsl:value-of select="substring-after(string(),'tar.gz')"/>
101 <xsl:text>&#xA;</xsl:text>
102 </xsl:when>
103 <!-- Setting $LANG for /etc/profile -->
104 <xsl:when test="ancestor::sect1[@id='ch-scripts-profile'] and
105 contains(string(),'export LANG=')">
106 <xsl:value-of select="substring-before(string(),'export LANG=')"/>
107 <xsl:text>export LANG=</xsl:text>
108 <xsl:value-of select="$lang"/>
109 <xsl:value-of select="substring-after(string(),'charmap]')"/>
110 <xsl:text>&#xA;</xsl:text>
111 </xsl:when>
112 <!-- Compile the keymap into the kernel has been disabled -->
113 <xsl:when test="contains(string(),'defkeymap')"/>
114 <!-- Copying the kernel config file -->
115 <xsl:when test="string() = 'make mrproper'">
116 <xsl:text>make mrproper&#xA;</xsl:text>
117 <xsl:text>cp -v ../kernel-config .config&#xA;</xsl:text>
118 </xsl:when>
119 <!-- No interactive commands are needed if the .config file is the proper one -->
120 <xsl:when test="contains(string(),'menuconfig')"/>
121 <!-- Don't stop on strip run -->
122 <xsl:when test="contains(string(),'strip ')">
123 <xsl:apply-templates/>
124 <xsl:text> || true&#xA;</xsl:text>
125 </xsl:when>
126 <!-- The rest of commands -->
127 <xsl:otherwise>
128 <xsl:apply-templates/>
129 <xsl:text>&#xA;</xsl:text>
130 </xsl:otherwise>
131 </xsl:choose>
132 </xsl:template>
133
134 <xsl:template match="replaceable">
135 <xsl:choose>
136 <xsl:when test="ancestor::sect1[@id='ch-cross-tools-glibc']">
137 <xsl:value-of select="$timezone"/>
138 </xsl:when>
139 <xsl:when test="ancestor::sect1[@id='ch-cross-tools-groff'] or
140 ancestor::sect1[@id='ch-system-groff']">
141 <xsl:value-of select="$page"/>
142 </xsl:when>
143 <xsl:otherwise>
144 <xsl:text>**EDITME</xsl:text>
145 <xsl:apply-templates/>
146 <xsl:text>EDITME**</xsl:text>
147 </xsl:otherwise>
148 </xsl:choose>
149 </xsl:template>
150
151</xsl:stylesheet>
Note: See TracBrowser for help on using the repository browser.