source: common/urls.xsl@ 4bc3c2b

1.0 2.3 2.3.x 2.4 ablfs ablfs-more legacy new_features trunk
Last change on this file since 4bc3c2b was 046d5c3, checked in by Manuel Canales Esparcia <manuel@…>, 19 years ago

Fixed powerpc-utils download URL.

  • Property mode set to 100644
File size: 4.2 KB
Line 
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 <!-- Write the upstream URLs, except the redirected ones -->
44 <xsl:choose>
45 <xsl:when test="contains(@url,'?')">
46 <xsl:text>dummy-url</xsl:text>
47 </xsl:when>
48 <xsl:otherwise>
49 <xsl:value-of select="@url"/>
50 </xsl:otherwise>
51 </xsl:choose>
52 <xsl:text> </xsl:text>
53 <!-- Write FTP mirror URLs -->
54 <xsl:value-of select="$server"/>
55 <xsl:text>/pub/lfs/conglomeration/</xsl:text>
56 <xsl:choose>
57 <!-- Fix some directories. Test against $dirname to be sure that we
58 are matching the start of a package name, not a string in a patch name
59 But some packages requires test against $package. -->
60 <xsl:when test="contains($dirname, 'bash')">
61 <xsl:text>bash/</xsl:text>
62 </xsl:when>
63 <xsl:when test="contains($package, 'dvhtool')">
64 <xsl:text>dvhtool/</xsl:text>
65 </xsl:when>
66 <xsl:when test="contains($dirname, 'gcc')">
67 <xsl:text>gcc/</xsl:text>
68 </xsl:when>
69 <xsl:when test="contains($dirname, 'glibc')">
70 <xsl:text>glibc/</xsl:text>
71 </xsl:when>
72 <xsl:when test="contains($package, 'powerpc-utils')">
73 <xsl:text>powerpc-utils/</xsl:text>
74 </xsl:when>
75 <xsl:when test="contains($package, 'tcl')">
76 <xsl:text>tcl/</xsl:text>
77 </xsl:when>
78 <xsl:when test="contains($dirname, 'uClibc')">
79 <xsl:text>uClibc/</xsl:text>
80 </xsl:when>
81 <xsl:when test="contains($dirname, 'udev')">
82 <xsl:text>udev/</xsl:text>
83 </xsl:when>
84 <xsl:otherwise>
85 <xsl:value-of select="$dirname"/>
86 <xsl:text>/</xsl:text>
87 </xsl:otherwise>
88 </xsl:choose>
89 <xsl:value-of select="$package"/>
90 <!-- Write MD5SUM value -->
91 <xsl:text> </xsl:text>
92 <xsl:value-of select="../..//para/literal"/>
93 <xsl:text>&#x0a;</xsl:text>
94 </xsl:if>
95 </xsl:template>
96
97 <xsl:template name="package.name">
98 <xsl:param name="url"/>
99 <xsl:choose>
100 <xsl:when test="contains($url, '/')">
101 <xsl:call-template name="package.name">
102 <xsl:with-param name="url" select="substring-after($url, '/')"/>
103 </xsl:call-template>
104 </xsl:when>
105 <xsl:otherwise>
106 <xsl:choose>
107 <xsl:when test="contains($url, '?')">
108 <xsl:value-of select="substring-before($url, '?')"/>
109 </xsl:when>
110 <xsl:otherwise>
111 <xsl:value-of select="$url"/>
112 </xsl:otherwise>
113 </xsl:choose>
114 </xsl:otherwise>
115 </xsl:choose>
116 </xsl:template>
117
118</xsl:stylesheet>
Note: See TracBrowser for help on using the repository browser.