source: common/urls.xsl@ d68d2c1

experimental
Last change on this file since d68d2c1 was c7e480d, checked in by Manuel Canales Esparcia <manuel@…>, 19 years ago

Merged r2672 from trunk.

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