source: BLFS/xsl/lfs_make_book.xsl@ d0d4181

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

Vim is in BLFS and should not be in LFS package list

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