source: common/urls.xsl@ 195ed9f

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

Added a forgottend ID line.

  • Property mode set to 100644
File size: 4.2 KB
RevLine 
[ebf8265]1<?xml version='1.0' encoding='ISO-8859-1'?>
2
[ca4c634]3<!-- $Id$ -->
4
[ebf8265]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')
[aa901e7]27 or contains(@url, '.patch')) and
[ebf8265]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 -->
[26053c4]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>
[15cad16]54 <xsl:text> </xsl:text>
[26053c4]55 <!-- Write FTP mirror URLs -->
[ebf8265]56 <xsl:value-of select="$server"/>
57 <xsl:text>/pub/lfs/conglomeration/</xsl:text>
58 <xsl:choose>
[046d5c3]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. -->
[e071571]62 <xsl:when test="contains($dirname, 'bash')">
[ebf8265]63 <xsl:text>bash/</xsl:text>
64 </xsl:when>
[9be4494]65 <xsl:when test="contains($package, 'dvhtool')">
66 <xsl:text>dvhtool/</xsl:text>
67 </xsl:when>
[e071571]68 <xsl:when test="contains($dirname, 'gcc')">
[c03b616]69 <xsl:text>gcc/</xsl:text>
70 </xsl:when>
[e071571]71 <xsl:when test="contains($dirname, 'glibc')">
[7453f74]72 <xsl:text>glibc/</xsl:text>
73 </xsl:when>
[046d5c3]74 <xsl:when test="contains($package, 'powerpc-utils')">
75 <xsl:text>powerpc-utils/</xsl:text>
76 </xsl:when>
[4887f67]77 <xsl:when test="contains($package, 'tcl')">
[7453f74]78 <xsl:text>tcl/</xsl:text>
79 </xsl:when>
[e071571]80 <xsl:when test="contains($dirname, 'uClibc')">
[c03b616]81 <xsl:text>uClibc/</xsl:text>
82 </xsl:when>
[e071571]83 <xsl:when test="contains($dirname, 'udev')">
[ee5e8f0]84 <xsl:text>udev/</xsl:text>
85 </xsl:when>
[ebf8265]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"/>
[26053c4]92 <!-- Write MD5SUM value -->
93 <xsl:text> </xsl:text>
[a3a1394]94 <xsl:value-of select="../..//para/literal"/>
[ebf8265]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.