1 | <?xml version="1.0" encoding="ISO-8859-1"?>
|
---|
2 |
|
---|
3 | <!-- $Id$ -->
|
---|
4 |
|
---|
5 | <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
|
---|
6 | version="1.0">
|
---|
7 |
|
---|
8 | <xsl:key name="idlfs" match="sect1" use="sect1info/productname"/>
|
---|
9 |
|
---|
10 | <xsl:template name="detect-lfs">
|
---|
11 | <xsl:param name="package"/>
|
---|
12 | <xsl:param name="lfsbook"/>
|
---|
13 | <xsl:choose>
|
---|
14 | <xsl:when test="$package='gcc' or
|
---|
15 | $package='dbus' or
|
---|
16 | $package='vim' or
|
---|
17 | $package='systemd' or
|
---|
18 | $package='Python' or
|
---|
19 | $package='shadow'"/>
|
---|
20 | <xsl:when test="$package='bootscripts'">true</xsl:when>
|
---|
21 | <xsl:when test="$package='kernel'">true</xsl:when>
|
---|
22 | <xsl:when test="$package='LFS-Release'">true</xsl:when>
|
---|
23 | <xsl:otherwise>
|
---|
24 | <xsl:for-each select="document($lfsbook)">
|
---|
25 | <xsl:copy-of select="boolean(key('idlfs',$package)/ancestor::chapter[@id='chapter-building-system'])"/>
|
---|
26 | </xsl:for-each>
|
---|
27 | </xsl:otherwise>
|
---|
28 | </xsl:choose>
|
---|
29 | </xsl:template>
|
---|
30 |
|
---|
31 | <xsl:template name="process-lfs">
|
---|
32 | <xsl:param name="package"/>
|
---|
33 | <xsl:param name="lfsbook"/>
|
---|
34 | <xsl:choose>
|
---|
35 | <xsl:when test="$package='gcc' or
|
---|
36 | $package='dbus' or
|
---|
37 | $package='vim' or
|
---|
38 | $package='systemd' or
|
---|
39 | $package='Python' or
|
---|
40 | $package='shadow'"/>
|
---|
41 | <xsl:when test="$package='bootscripts'">
|
---|
42 | <xsl:for-each select="document($lfsbook)">
|
---|
43 | <xsl:apply-templates select="key('idlfs',$package)[ancestor::chapter/@id='chapter-bootscripts']" mode="lfs"/>
|
---|
44 | </xsl:for-each>
|
---|
45 | </xsl:when>
|
---|
46 | <xsl:when test="$package='kernel'">
|
---|
47 | <xsl:for-each select="document($lfsbook)">
|
---|
48 | <xsl:apply-templates select="key('idlfs',$package)[ancestor::chapter/@id='chapter-bootable']" mode="lfs"/>
|
---|
49 | </xsl:for-each>
|
---|
50 | </xsl:when>
|
---|
51 | <xsl:when test="$package='LFS-Release'">
|
---|
52 | <sect1 id="LFS-Release">
|
---|
53 | <xsl:apply-templates select="document($lfsbook)//sect1[@id='ch-finish-theend']/*" mode="lfs-remap"/>
|
---|
54 | </sect1>
|
---|
55 | </xsl:when>
|
---|
56 | <xsl:otherwise>
|
---|
57 | <xsl:for-each select="document($lfsbook)">
|
---|
58 | <xsl:apply-templates select="key('idlfs',$package)[ancestor::chapter/@id='chapter-building-system']" mode="lfs"/>
|
---|
59 | </xsl:for-each>
|
---|
60 | </xsl:otherwise>
|
---|
61 | </xsl:choose>
|
---|
62 | </xsl:template>
|
---|
63 |
|
---|
64 | <xsl:template match="*" mode="lfs">
|
---|
65 | <xsl:choose>
|
---|
66 | <!--variablelist may contain id attributes equal to the name of the package,
|
---|
67 | which generates non-unique id. They are of not much use (short descriptions)
|
---|
68 | here. So just remove them-->
|
---|
69 | <xsl:when test="self::variablelist"/>
|
---|
70 | <!--The id's in lfs are of the form ch-xxx-package. We do not want to
|
---|
71 | use that for file names and the like. So change the id-->
|
---|
72 | <xsl:when test="self::sect1">
|
---|
73 | <xsl:element name="sect1">
|
---|
74 | <xsl:attribute name="id">
|
---|
75 | <xsl:choose>
|
---|
76 | <xsl:when
|
---|
77 | test="./sect1info/productname=
|
---|
78 | 'bootscripts'">lfs-bootscripts</xsl:when>
|
---|
79 | <xsl:otherwise>
|
---|
80 | <xsl:value-of select="./sect1info/productname"/>
|
---|
81 | </xsl:otherwise>
|
---|
82 | </xsl:choose>
|
---|
83 | </xsl:attribute>
|
---|
84 | <xsl:apply-templates mode="lfs"/>
|
---|
85 | </xsl:element>
|
---|
86 | </xsl:when>
|
---|
87 | <xsl:when test=".//sect2">
|
---|
88 | <xsl:element name="{name()}">
|
---|
89 | <xsl:for-each select="attribute::*">
|
---|
90 | <xsl:attribute name="{name()}">
|
---|
91 | <xsl:value-of select="."/>
|
---|
92 | </xsl:attribute>
|
---|
93 | </xsl:for-each>
|
---|
94 | <xsl:apply-templates mode="lfs"/>
|
---|
95 | </xsl:element>
|
---|
96 | </xsl:when>
|
---|
97 | <xsl:when test="self::sect2[@role='package']">
|
---|
98 | <xsl:variable name="url" select="../sect1info/address/text()"/>
|
---|
99 | <xsl:variable name="md5" select="//sect1[@id='materials-packages']//ulink[@url=$url]/../following-sibling::para/literal/text()"/>
|
---|
100 | <xsl:variable name="patch">
|
---|
101 | <xsl:call-template name="find-patch"/>
|
---|
102 | </xsl:variable>
|
---|
103 | <sect2 role="package">
|
---|
104 | <xsl:copy-of select="./*"/>
|
---|
105 | <bridgehead renderas="sect3">Package Information</bridgehead>
|
---|
106 | <itemizedlist spacing="compact">
|
---|
107 | <listitem>
|
---|
108 | <para>
|
---|
109 | Download (HTTP): <!--<xsl:element name="ulink">
|
---|
110 | <xsl:attribute name="url">
|
---|
111 | <xsl:value-of select="$url"/>
|
---|
112 | </xsl:attribute>
|
---|
113 | </xsl:element>--><ulink url="{$url}"/>
|
---|
114 | </para>
|
---|
115 | </listitem>
|
---|
116 | <listitem>
|
---|
117 | <para>
|
---|
118 | Download (FTP): <ulink url=" "/>
|
---|
119 | </para>
|
---|
120 | </listitem>
|
---|
121 | <listitem>
|
---|
122 | <para>
|
---|
123 | Download MD5 sum: <xsl:value-of select="$md5"/>
|
---|
124 | </para>
|
---|
125 | </listitem>
|
---|
126 | </itemizedlist>
|
---|
127 | <xsl:if test="string-length($patch)>10">
|
---|
128 | <bridgehead renderas="sect3">Additional Downloads</bridgehead>
|
---|
129 | <itemizedlist spacing="compact">
|
---|
130 | <listitem>
|
---|
131 | <para>
|
---|
132 | Required patch:
|
---|
133 | <ulink url="{$patch}"/>
|
---|
134 | </para>
|
---|
135 | </listitem>
|
---|
136 | </itemizedlist>
|
---|
137 | </xsl:if>
|
---|
138 | </sect2>
|
---|
139 | </xsl:when>
|
---|
140 | <xsl:when test="self::sect2[@role='installation']">
|
---|
141 | <sect2 role="installation">
|
---|
142 | <xsl:apply-templates mode="lfs-remap"/>
|
---|
143 | </sect2>
|
---|
144 | </xsl:when>
|
---|
145 | <xsl:when test="self::sect2[@role='configuration']">
|
---|
146 | <sect2 role="configuration">
|
---|
147 | <xsl:apply-templates mode="lfs-remap"/>
|
---|
148 | </sect2>
|
---|
149 | </xsl:when>
|
---|
150 | <xsl:when test="self::sect2">
|
---|
151 | <xsl:element name="sect2">
|
---|
152 | <xsl:for-each select="attribute::*">
|
---|
153 | <xsl:attribute name="{name()}">
|
---|
154 | <xsl:value-of select="."/>
|
---|
155 | </xsl:attribute>
|
---|
156 | </xsl:for-each>
|
---|
157 | <xsl:apply-templates mode="lfs"/>
|
---|
158 | </xsl:element>
|
---|
159 | </xsl:when>
|
---|
160 | <xsl:otherwise><!--
|
---|
161 | <xsl:element name="{name()}">
|
---|
162 | <xsl:for-each select="attribute::*">
|
---|
163 | <xsl:attribute name="{name()}">
|
---|
164 | <xsl:value-of select="."/>
|
---|
165 | </xsl:attribute>
|
---|
166 | </xsl:for-each>
|
---|
167 | <xsl:apply-templates/>
|
---|
168 | </xsl:element>-->
|
---|
169 | <xsl:copy-of select="."/>
|
---|
170 | </xsl:otherwise>
|
---|
171 | </xsl:choose>
|
---|
172 | </xsl:template>
|
---|
173 |
|
---|
174 | <xsl:template name="find-patch">
|
---|
175 | <xsl:variable name="patch-command" select="..//userinput[contains(string(),'patch -Np1')]/text()"/>
|
---|
176 | <xsl:variable name="patch" select="substring-after($patch-command,'../')"/>
|
---|
177 | <xsl:if test="string-length($patch) > 10">
|
---|
178 | <xsl:value-of select="//sect1[@id='materials-patches']//ulink/@url[contains(string(),$patch)]"/>
|
---|
179 | </xsl:if>
|
---|
180 | </xsl:template>
|
---|
181 |
|
---|
182 | <xsl:template match="*" mode="lfs-remap">
|
---|
183 | <xsl:choose>
|
---|
184 | <xsl:when test=".//screen">
|
---|
185 | <xsl:element name="{name()}">
|
---|
186 | <xsl:for-each select="attribute::*">
|
---|
187 | <xsl:attribute name="{name()}">
|
---|
188 | <xsl:value-of select="."/>
|
---|
189 | </xsl:attribute>
|
---|
190 | </xsl:for-each>
|
---|
191 | <xsl:apply-templates mode="lfs-remap"/>
|
---|
192 | </xsl:element>
|
---|
193 | </xsl:when>
|
---|
194 | <xsl:when test="self::screen">
|
---|
195 | <xsl:choose>
|
---|
196 | <!-- Since we are using the *-full.xml files, revisions have already been
|
---|
197 | selected, so no need to bother about revision attributes-->
|
---|
198 | <xsl:when test="@role='nodump'">
|
---|
199 | <xsl:copy-of select="."/>
|
---|
200 | </xsl:when>
|
---|
201 | <xsl:when test="contains(string(),'<your name here>')">
|
---|
202 | <screen role="root"><userinput>
|
---|
203 | <xsl:copy-of
|
---|
204 | select="substring-before(string(),'<your name here>')"/>
|
---|
205 | <xsl:text>jhalfs</xsl:text>
|
---|
206 | <xsl:copy-of
|
---|
207 | select="substring-after(string(),'<your name here>')"/>
|
---|
208 | </userinput></screen>
|
---|
209 | </xsl:when>
|
---|
210 | <xsl:when test="./userinput[@remap='install' or not(@remap)]">
|
---|
211 | <screen role="root">
|
---|
212 | <xsl:copy-of select="./*"/>
|
---|
213 | </screen>
|
---|
214 | </xsl:when>
|
---|
215 | <xsl:when test="./userinput[@remap='test']">
|
---|
216 | <para><command>
|
---|
217 | <xsl:copy-of select="./userinput/text()"/>
|
---|
218 | </command></para>
|
---|
219 | </xsl:when>
|
---|
220 | <xsl:otherwise>
|
---|
221 | <xsl:copy-of select="."/>
|
---|
222 | </xsl:otherwise>
|
---|
223 | </xsl:choose>
|
---|
224 | </xsl:when>
|
---|
225 | <xsl:otherwise><!--
|
---|
226 | <xsl:copy-of select="."/>-->
|
---|
227 | <xsl:element name="{name()}">
|
---|
228 | <xsl:for-each select="attribute::*">
|
---|
229 | <xsl:attribute name="{name()}">
|
---|
230 | <xsl:value-of select="."/>
|
---|
231 | </xsl:attribute>
|
---|
232 | </xsl:for-each>
|
---|
233 | <xsl:apply-templates mode="sect1"/>
|
---|
234 | </xsl:element>
|
---|
235 | </xsl:otherwise>
|
---|
236 | </xsl:choose>
|
---|
237 | </xsl:template>
|
---|
238 | </xsl:stylesheet>
|
---|