Fix gen-special when an entity is commented out:
[automated_linux_from_scratch.git] / branches / new_features / common / packages.xsl
blobf77801fa02315f87269b59fa7c789fd9dc89d979
1 <?xml version='1.0' encoding='ISO-8859-1'?>
3 <!-- $Id$ -->
5 <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
6 version="1.0">
8 <xsl:output method="text"/>
10 <!-- The libc model used for HLFS -->
11 <xsl:param name="model" select="'glibc'"/>
13 <!-- The kernel series used for HLFS -->
14 <xsl:param name="kernel" select="'2.6'"/>
16 <!-- Should we include a package manager? -->
17 <xsl:param name="pkgmngt" select="'n'"/>
19 <!-- The system for LFS: sysv of systemd -->
20 <xsl:param name="revision" select="'sysv'"/>
22 <xsl:template match="/">
23 <xsl:apply-templates select="//para"/>
24 <xsl:if test="$pkgmngt='y'">
25 <xsl:apply-templates
26 select="document('packageManager.xml')//sect1[@id='package']//para"/>
27 </xsl:if>
28 </xsl:template>
30 <xsl:template match="para">
31 <xsl:if test="contains(string(),'Download:') and
32 (ancestor::varlistentry[@condition=$model]
33 or not(ancestor::varlistentry[@condition])) and
34 (ancestor::varlistentry[@revision=$revision]
35 or not(ancestor::varlistentry[@revision])) and
36 (ancestor::varlistentry[@vendor=$kernel]
37 or not(ancestor::varlistentry[@vendor]))">
38 <xsl:call-template name="package_name">
39 <xsl:with-param name="url" select="ulink/@url"/>
40 </xsl:call-template>
41 </xsl:if>
42 </xsl:template>
44 <xsl:template name="package_name">
45 <xsl:param name="url" select="foo"/>
46 <xsl:variable name="sub-url" select="substring-after($url,'/')"/>
47 <xsl:choose>
48 <xsl:when test="contains($sub-url,'/') and
49 not(substring-after($sub-url,'/')='')">
50 <xsl:call-template name="package_name">
51 <xsl:with-param name="url" select="$sub-url"/>
52 </xsl:call-template>
53 </xsl:when>
54 <xsl:otherwise>
55 <xsl:choose>
56 <xsl:when test="contains($sub-url,'.patch')"/>
57 <xsl:when test="contains($sub-url,'?')">
58 <xsl:value-of select="substring-before($sub-url,'?')"/>
59 <xsl:text>&#xA;</xsl:text>
60 </xsl:when>
61 <xsl:when test="contains($sub-url,'/')">
62 <xsl:value-of select="substring-before($sub-url,'/')"/>
63 <xsl:text>&#xA;</xsl:text>
64 </xsl:when>
65 <xsl:otherwise>
66 <xsl:value-of select="$sub-url"/>
67 <xsl:text>&#xA;</xsl:text>
68 </xsl:otherwise>
69 </xsl:choose>
70 </xsl:otherwise>
71 </xsl:choose>
72 </xsl:template>
74 </xsl:stylesheet>