1 | <?xml version='1.0' encoding='ISO-8859-1'?>
|
---|
2 |
|
---|
3 | <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
|
---|
4 | version="1.0">
|
---|
5 |
|
---|
6 | <xsl:output method="text"/>
|
---|
7 |
|
---|
8 | <!-- The FTP server used as fallback -->
|
---|
9 | <xsl:param name="server">ftp://ftp.osuosl.org</xsl:param>
|
---|
10 |
|
---|
11 | <!-- The libc model used for HLFS -->
|
---|
12 | <xsl:param name="model" select="glibc"/>
|
---|
13 |
|
---|
14 | <xsl:template match="/">
|
---|
15 | <xsl:apply-templates select="//ulink"/>
|
---|
16 | </xsl:template>
|
---|
17 |
|
---|
18 | <xsl:template match="ulink">
|
---|
19 | <!-- If some package don't have the predefined strings in their
|
---|
20 | name, the next test must be fixed to match it also. Skip possible
|
---|
21 | duplicated URLs due that may be splitted for PDF output -->
|
---|
22 | <xsl:if test="(ancestor::varlistentry[@condition=$model]
|
---|
23 | or not(ancestor::varlistentry[@condition])) and
|
---|
24 | (contains(@url, '.tar.') or contains(@url, '.tgz')
|
---|
25 | or contains(@url, '.patch')) and
|
---|
26 | not(ancestor-or-self::*/@condition = 'pdf')">
|
---|
27 | <!-- Extract the package name -->
|
---|
28 | <xsl:variable name="package">
|
---|
29 | <xsl:call-template name="package.name">
|
---|
30 | <xsl:with-param name="url" select="@url"/>
|
---|
31 | </xsl:call-template>
|
---|
32 | </xsl:variable>
|
---|
33 | <!-- Extract the directory for that package -->
|
---|
34 | <xsl:variable name="cut"
|
---|
35 | select="translate(substring-after($package, '-'),
|
---|
36 | '0123456789', '0000000000')"/>
|
---|
37 | <xsl:variable name="package2">
|
---|
38 | <xsl:value-of select="substring-before($package, '-')"/>
|
---|
39 | <xsl:text>-</xsl:text>
|
---|
40 | <xsl:value-of select="$cut"/>
|
---|
41 | </xsl:variable>
|
---|
42 | <xsl:variable name="dirname" select="substring-before($package2, '-0')"/>
|
---|
43 | <xsl:message>
|
---|
44 | <xsl:text>pakage is: </xsl:text>
|
---|
45 | <xsl:value-of select="$package"/>
|
---|
46 | <xsl:text>
</xsl:text>
|
---|
47 | <xsl:text>pakage2 is: </xsl:text>
|
---|
48 | <xsl:value-of select="$package2"/>
|
---|
49 | <xsl:text>
</xsl:text>
|
---|
50 | <xsl:text>dirname is: </xsl:text>
|
---|
51 | <xsl:value-of select="$dirname"/>
|
---|
52 | <xsl:text>

</xsl:text>
|
---|
53 | </xsl:message>
|
---|
54 | <!-- Write the upstream URLs, except the redirected ones -->
|
---|
55 | <xsl:choose>
|
---|
56 | <xsl:when test="contains(@url,'?')">
|
---|
57 | <xsl:text>dummy-url</xsl:text>
|
---|
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/lfs/conglomeration/</xsl:text>
|
---|
67 | <xsl:choose>
|
---|
68 | <!-- Fix some directories. Test against dirname to be sure that we
|
---|
69 | are matching the start of a package name, not a string in a patch name -->
|
---|
70 | <xsl:when test="contains($dirname, 'bash')">
|
---|
71 | <xsl:text>bash/</xsl:text>
|
---|
72 | </xsl:when>
|
---|
73 | <xsl:when test="contains($dirname, 'gcc')">
|
---|
74 | <xsl:text>gcc/</xsl:text>
|
---|
75 | </xsl:when>
|
---|
76 | <xsl:when test="contains($dirname, 'glibc')">
|
---|
77 | <xsl:text>glibc/</xsl:text>
|
---|
78 | </xsl:when>
|
---|
79 | <xsl:when test="contains($package, 'tcl')">
|
---|
80 | <xsl:text>tcl/</xsl:text>
|
---|
81 | </xsl:when>
|
---|
82 | <xsl:when test="contains($dirname, 'uClibc')">
|
---|
83 | <xsl:text>uClibc/</xsl:text>
|
---|
84 | </xsl:when>
|
---|
85 | <xsl:when test="contains($dirname, 'udev')">
|
---|
86 | <xsl:text>udev/</xsl:text>
|
---|
87 | </xsl:when>
|
---|
88 | <xsl:otherwise>
|
---|
89 | <xsl:value-of select="$dirname"/>
|
---|
90 | <xsl:text>/</xsl:text>
|
---|
91 | </xsl:otherwise>
|
---|
92 | </xsl:choose>
|
---|
93 | <xsl:value-of select="$package"/>
|
---|
94 | <!-- Write MD5SUM value -->
|
---|
95 | <xsl:text> </xsl:text>
|
---|
96 | <xsl:value-of select="../..//para/literal"/>
|
---|
97 | <xsl:text>
</xsl:text>
|
---|
98 | </xsl:if>
|
---|
99 | </xsl:template>
|
---|
100 |
|
---|
101 | <xsl:template name="package.name">
|
---|
102 | <xsl:param name="url"/>
|
---|
103 | <xsl:choose>
|
---|
104 | <xsl:when test="contains($url, '/')">
|
---|
105 | <xsl:call-template name="package.name">
|
---|
106 | <xsl:with-param name="url" select="substring-after($url, '/')"/>
|
---|
107 | </xsl:call-template>
|
---|
108 | </xsl:when>
|
---|
109 | <xsl:otherwise>
|
---|
110 | <xsl:choose>
|
---|
111 | <xsl:when test="contains($url, '?')">
|
---|
112 | <xsl:value-of select="substring-before($url, '?')"/>
|
---|
113 | </xsl:when>
|
---|
114 | <xsl:otherwise>
|
---|
115 | <xsl:value-of select="$url"/>
|
---|
116 | </xsl:otherwise>
|
---|
117 | </xsl:choose>
|
---|
118 | </xsl:otherwise>
|
---|
119 | </xsl:choose>
|
---|
120 | </xsl:template>
|
---|
121 |
|
---|
122 | </xsl:stylesheet>
|
---|