source: common/urls.xsl@ f98695c

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

Added a forgottend ID line.

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