source: common/urls.xsl@ 4b80795

trunk
Last change on this file since 4b80795 was c1f02f2, checked in by Pierre Labastie <pierre.labastie@…>, 12 months ago

LFS: remove alternate server code

It's been broken for years, and nobody has complained, so I'd say
it is not useful. If a user wants to use a mirror instead of upstream,
better use a wget-list directly on this server...

  • Property mode set to 100644
File size: 2.6 KB
Line 
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 <!-- Do we use a package manager? -->
9 <xsl:param name="pkgmngt" select="'n'"/>
10
11 <!-- The system for LFS: sysv of systemd -->
12 <xsl:param name="revision" select="'sysv'"/>
13
14 <xsl:template match="/">
15 <xsl:apply-templates select="//varlistentry[@revision=$revision
16 or not(@revision)]//ulink"/>
17 <xsl:if test="$pkgmngt='y'">
18 <xsl:apply-templates
19 select="document('packageManager.xml')//ulink"/>
20 </xsl:if>
21 </xsl:template>
22
23 <xsl:template match="ulink">
24 <!-- If some package doesn'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="(contains(@url, '.bz2') or contains(@url, '.tar.gz') or
28 contains(@url, '.tgz') or contains(@url, '.patch') or
29 contains(@url, '.xz') or contains(@url, '.lzma')) and
30 not(ancestor-or-self::*/@condition = 'pdf')">
31 <!-- Extract the package name -->
32 <xsl:variable name="package">
33 <xsl:call-template name="package.name">
34 <xsl:with-param name="url" select="@url"/>
35 </xsl:call-template>
36 </xsl:variable>
37 <!-- Write the upstream URLs, fixing the redirected ones -->
38 <xsl:choose>
39 <xsl:when test="contains(@url,'?')">
40 <xsl:value-of select="substring-before(@url,'?')"/>
41 </xsl:when>
42 <xsl:otherwise>
43 <xsl:value-of select="@url"/>
44 </xsl:otherwise>
45 </xsl:choose>
46 <!-- Write MD5SUM value -->
47 <xsl:text> </xsl:text>
48 <xsl:value-of select="../following-sibling::para/literal"/>
49 <xsl:text>&#x0a;</xsl:text>
50 </xsl:if>
51 </xsl:template>
52
53 <xsl:template name="package.name">
54 <xsl:param name="url"/>
55 <xsl:choose>
56 <xsl:when test="contains($url, '/') and not (substring-after($url,'/')='')">
57 <xsl:call-template name="package.name">
58 <xsl:with-param name="url" select="substring-after($url, '/')"/>
59 </xsl:call-template>
60 </xsl:when>
61 <xsl:otherwise>
62 <xsl:choose>
63 <xsl:when test="contains($url, '?')">
64 <xsl:value-of select="substring-before($url, '?')"/>
65 </xsl:when>
66 <xsl:otherwise>
67 <xsl:value-of select="$url"/>
68 </xsl:otherwise>
69 </xsl:choose>
70 </xsl:otherwise>
71 </xsl:choose>
72 </xsl:template>
73
74</xsl:stylesheet>
Note: See TracBrowser for help on using the repository browser.