source: common/urls.xsl@ 26053c4

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

Added support for MD5 values sets into the book sources.

  • Property mode set to 100644
File size: 3.9 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 <!-- 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')
25 or contains(@url, '.patch')) and
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 -->
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>
52 <xsl:text> </xsl:text>
53 <!-- Write FTP mirror URLs -->
54 <xsl:value-of select="$server"/>
55 <xsl:text>/pub/lfs/conglomeration/</xsl:text>
56 <xsl:choose>
57 <!-- Fix some directories. Test against package2 to be sure that we
58 are matching the start of a package name, not a string in a patch name -->
59 <xsl:when test="contains($package2, 'bash')">
60 <xsl:text>bash/</xsl:text>
61 </xsl:when>
62 <xsl:when test="contains($package2, 'gcc')">
63 <xsl:text>gcc/</xsl:text>
64 </xsl:when>
65 <xsl:when test="contains($package2, 'glibc')">
66 <xsl:text>glibc/</xsl:text>
67 </xsl:when>
68 <xsl:when test="contains($package2, 'tcl')">
69 <xsl:text>tcl/</xsl:text>
70 </xsl:when>
71 <xsl:when test="contains($package2, 'uClibc')">
72 <xsl:text>uClibc/</xsl:text>
73 </xsl:when>
74 <xsl:when test="contains($package2, 'udev')">
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"/>
83 <!-- Write MD5SUM value -->
84 <xsl:text> </xsl:text>
85 <xsl:value-of select="../../para[3]/literal"/>
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.