source: common/urls.xsl@ f5f857d

experimental
Last change on this file since f5f857d was 9c9775f, checked in by Manuel Canales Esparcia <manuel@…>, 17 years ago

Updated experimental branch to current trunk code.

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