source: common/urls.xsl@ 962793a

2.3 2.3.x 2.4 ablfs ablfs-more legacy new_features trunk
Last change on this file since 962793a was a9ca77f, checked in by Manuel Canales Esparcia <manuel@…>, 18 years ago

Fixed FTP mirror path for CLFSx books.

  • Property mode set to 100644
File size: 4.5 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 <xsl:template match="/">
20 <xsl:apply-templates select="//ulink"/>
21 </xsl:template>
22
23 <xsl:template match="ulink">
24 <!-- If some package don't have the predefined strings in their
25 name, the next test must be fixed to match it also. Skip possible
26 duplicated URLs due that may be splitted for PDF output -->
27 <xsl:if test="(ancestor::varlistentry[@condition=$model]
28 or not(ancestor::varlistentry[@condition])) and
29 (contains(@url, '.bz2') or contains(@url, '.tar.gz') or
30 contains(@url, '.tgz') or contains(@url, '.patch')) and
31 not(ancestor-or-self::*/@condition = 'pdf')">
32 <!-- Extract the package name -->
33 <xsl:variable name="package">
34 <xsl:call-template name="package.name">
35 <xsl:with-param name="url" select="@url"/>
36 </xsl:call-template>
37 </xsl:variable>
38 <!-- Extract the directory for that package -->
39 <xsl:variable name="cut"
40 select="translate(substring-after($package, '-'),
41 '0123456789', '0000000000')"/>
42 <xsl:variable name="package2">
43 <xsl:value-of select="substring-before($package, '-')"/>
44 <xsl:text>-</xsl:text>
45 <xsl:value-of select="$cut"/>
46 </xsl:variable>
47 <xsl:variable name="dirname" select="substring-before($package2, '-0')"/>
48 <!-- Write the upstream URLs, fixing the redirected ones -->
49 <xsl:choose>
50 <xsl:when test="contains(@url,'?')">
51 <xsl:value-of select="substring-before(@url,'?')"/>
52 </xsl:when>
53 <xsl:otherwise>
54 <xsl:value-of select="@url"/>
55 </xsl:otherwise>
56 </xsl:choose>
57 <xsl:text> </xsl:text>
58 <!-- Write FTP mirror URLs -->
59 <xsl:value-of select="$server"/>
60 <xsl:text>/pub/</xsl:text>
61 <xsl:value-of select="$family"/>
62 <xsl:text>/conglomeration/</xsl:text>
63 <xsl:choose>
64 <!-- Fix some directories. Test against $dirname to be sure that we
65 are matching the start of a package name, not a string in a patch name
66 But some packages requires test against $package. -->
67 <xsl:when test="contains($dirname, 'bash')">
68 <xsl:text>bash/</xsl:text>
69 </xsl:when>
70 <xsl:when test="contains($package, 'dvhtool')">
71 <xsl:text>dvhtool/</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, 'powerpc-utils')">
80 <xsl:text>powerpc-utils/</xsl:text>
81 </xsl:when>
82 <xsl:when test="contains($package, 'tcl')">
83 <xsl:text>tcl/</xsl:text>
84 </xsl:when>
85 <xsl:when test="contains($package, 'uClibc')">
86 <xsl:text>uClibc/</xsl:text>
87 </xsl:when>
88 <xsl:when test="contains($dirname, 'udev')">
89 <xsl:text>udev/</xsl:text>
90 </xsl:when>
91 <xsl:otherwise>
92 <xsl:value-of select="$dirname"/>
93 <xsl:text>/</xsl:text>
94 </xsl:otherwise>
95 </xsl:choose>
96 <xsl:value-of select="$package"/>
97 <!-- Write MD5SUM value -->
98 <xsl:text> </xsl:text>
99 <xsl:value-of select="../..//para/literal"/>
100 <xsl:text>&#x0a;</xsl:text>
101 </xsl:if>
102 </xsl:template>
103
104 <xsl:template name="package.name">
105 <xsl:param name="url"/>
106 <xsl:choose>
107 <xsl:when test="contains($url, '/')">
108 <xsl:call-template name="package.name">
109 <xsl:with-param name="url" select="substring-after($url, '/')"/>
110 </xsl:call-template>
111 </xsl:when>
112 <xsl:otherwise>
113 <xsl:choose>
114 <xsl:when test="contains($url, '?')">
115 <xsl:value-of select="substring-before($url, '?')"/>
116 </xsl:when>
117 <xsl:otherwise>
118 <xsl:value-of select="$url"/>
119 </xsl:otherwise>
120 </xsl:choose>
121 </xsl:otherwise>
122 </xsl:choose>
123 </xsl:template>
124
125</xsl:stylesheet>
Note: See TracBrowser for help on using the repository browser.