source: CLFS3/clfs3.xsl@ f756851

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

Remove $Id$ comments, they are useless with git

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