source: common/urls.xsl@ 9c9775f

experimental
Last change on this file since 9c9775f was 9c9775f, checked in by Manuel Canales Esparcia <manuel@…>, 17 years ago

Updated experimental branch to current trunk code.

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