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:output method="text"/>
|
---|
9 |
|
---|
10 | <!-- The FTP server used as fallback -->
|
---|
11 | <xsl:param name="server">ftp://ftp.osuosl.org</xsl:param>
|
---|
12 |
|
---|
13 | <!-- The book family (lfs or clfs). Needed to use the proper FTP path. -->
|
---|
14 | <xsl:param name="family">lfs</xsl:param>
|
---|
15 |
|
---|
16 | <!-- The libc model used for HLFS -->
|
---|
17 | <xsl:param name="model" select="glibc"/>
|
---|
18 |
|
---|
19 | <!-- The kernel series used for HLFS -->
|
---|
20 | <xsl:param name="kernel" select="2.6"/>
|
---|
21 |
|
---|
22 | <xsl:template match="/">
|
---|
23 | <xsl:apply-templates select="//ulink"/>
|
---|
24 | </xsl:template>
|
---|
25 |
|
---|
26 | <xsl:template match="ulink">
|
---|
27 | <!-- If some package don't have the predefined strings in their
|
---|
28 | name, the next test must be fixed to match it also. Skip possible
|
---|
29 | duplicated URLs due that may be splitted for PDF output -->
|
---|
30 | <xsl:if test="(ancestor::varlistentry[@condition=$model]
|
---|
31 | or not(ancestor::varlistentry[@condition])) and
|
---|
32 | (ancestor::varlistentry[@vendor=$kernel]
|
---|
33 | or not(ancestor::varlistentry[@vendor])) and
|
---|
34 | (contains(@url, '.bz2') or contains(@url, '.tar.gz') or
|
---|
35 | contains(@url, '.tgz') or contains(@url, '.patch') or
|
---|
36 | contains(@url, '.xz')) and
|
---|
37 | not(ancestor-or-self::*/@condition = 'pdf')">
|
---|
38 | <!-- Extract the package name -->
|
---|
39 | <xsl:variable name="package">
|
---|
40 | <xsl:call-template name="package.name">
|
---|
41 | <xsl:with-param name="url" select="@url"/>
|
---|
42 | </xsl:call-template>
|
---|
43 | </xsl:variable>
|
---|
44 | <!-- Extract the directory for that package -->
|
---|
45 | <xsl:variable name="cut"
|
---|
46 | select="translate(substring-after($package, '-'),
|
---|
47 | '0123456789', '0000000000')"/>
|
---|
48 | <xsl:variable name="package2">
|
---|
49 | <xsl:value-of select="substring-before($package, '-')"/>
|
---|
50 | <xsl:text>-</xsl:text>
|
---|
51 | <xsl:value-of select="$cut"/>
|
---|
52 | </xsl:variable>
|
---|
53 | <xsl:variable name="dirname" select="substring-before($package2, '-0')"/>
|
---|
54 | <!-- Write the upstream URLs, fixing the redirected ones -->
|
---|
55 | <xsl:choose>
|
---|
56 | <xsl:when test="contains(@url,'?')">
|
---|
57 | <xsl:value-of select="substring-before(@url,'?')"/>
|
---|
58 | </xsl:when>
|
---|
59 | <xsl:otherwise>
|
---|
60 | <xsl:value-of select="@url"/>
|
---|
61 | </xsl:otherwise>
|
---|
62 | </xsl:choose>
|
---|
63 | <xsl:text> </xsl:text>
|
---|
64 | <!-- Write FTP mirror URLs -->
|
---|
65 | <xsl:value-of select="$server"/>
|
---|
66 | <xsl:text>/pub/</xsl:text>
|
---|
67 | <xsl:value-of select="$family"/>
|
---|
68 | <xsl:text>/conglomeration/</xsl:text>
|
---|
69 | <xsl:choose>
|
---|
70 | <!-- Fix some directories. Test against $dirname to be sure that we
|
---|
71 | are matching the start of a package name, not a string in a patch name
|
---|
72 | But some packages requires test against $package. -->
|
---|
73 | <xsl:when test="contains($dirname, 'bash')">
|
---|
74 | <xsl:text>bash/</xsl:text>
|
---|
75 | </xsl:when>
|
---|
76 | <xsl:when test="contains($package, 'dvhtool')">
|
---|
77 | <xsl:text>dvhtool/</xsl:text>
|
---|
78 | </xsl:when>
|
---|
79 | <xsl:when test="contains($dirname, 'gcc')">
|
---|
80 | <xsl:text>gcc/</xsl:text>
|
---|
81 | </xsl:when>
|
---|
82 | <xsl:when test="contains($dirname, 'glibc')">
|
---|
83 | <xsl:text>glibc/</xsl:text>
|
---|
84 | </xsl:when>
|
---|
85 | <xsl:when test="contains($package, 'powerpc-utils')">
|
---|
86 | <xsl:text>powerpc-utils/</xsl:text>
|
---|
87 | </xsl:when>
|
---|
88 | <xsl:when test="contains($package, 'tcl')">
|
---|
89 | <xsl:text>tcl/</xsl:text>
|
---|
90 | </xsl:when>
|
---|
91 | <xsl:when test="contains($package, 'uClibc')">
|
---|
92 | <xsl:text>uClibc/</xsl:text>
|
---|
93 | </xsl:when>
|
---|
94 | <xsl:when test="contains($dirname, 'udev')">
|
---|
95 | <xsl:text>udev/</xsl:text>
|
---|
96 | </xsl:when>
|
---|
97 | <xsl:otherwise>
|
---|
98 | <xsl:value-of select="$dirname"/>
|
---|
99 | <xsl:text>/</xsl:text>
|
---|
100 | </xsl:otherwise>
|
---|
101 | </xsl:choose>
|
---|
102 | <xsl:value-of select="$package"/>
|
---|
103 | <!-- Write MD5SUM value -->
|
---|
104 | <xsl:text> </xsl:text>
|
---|
105 | <xsl:value-of select="../..//para/literal"/>
|
---|
106 | <xsl:text>
</xsl:text>
|
---|
107 | </xsl:if>
|
---|
108 | </xsl:template>
|
---|
109 |
|
---|
110 | <xsl:template name="package.name">
|
---|
111 | <xsl:param name="url"/>
|
---|
112 | <xsl:choose>
|
---|
113 | <xsl:when test="contains($url, '/')">
|
---|
114 | <xsl:call-template name="package.name">
|
---|
115 | <xsl:with-param name="url" select="substring-after($url, '/')"/>
|
---|
116 | </xsl:call-template>
|
---|
117 | </xsl:when>
|
---|
118 | <xsl:otherwise>
|
---|
119 | <xsl:choose>
|
---|
120 | <xsl:when test="contains($url, '?')">
|
---|
121 | <xsl:value-of select="substring-before($url, '?')"/>
|
---|
122 | </xsl:when>
|
---|
123 | <xsl:otherwise>
|
---|
124 | <xsl:value-of select="$url"/>
|
---|
125 | </xsl:otherwise>
|
---|
126 | </xsl:choose>
|
---|
127 | </xsl:otherwise>
|
---|
128 | </xsl:choose>
|
---|
129 | </xsl:template>
|
---|
130 |
|
---|
131 | </xsl:stylesheet>
|
---|