source: BLFS/xsl/lfs_make_book.xsl@ e030049

ablfs-more legacy trunk
Last change on this file since e030049 was 8740529, checked in by Pierre Labastie <pierre@…>, 7 years ago

Add ninja and python to the list of LFS packages which should not appear,
since they are also in BLFS

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