source: common/urls.xsl@ aa901e7

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

Few updates to match last LFS book changes.

  • Property mode set to 100644
File size: 3.7 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:if test="not(contains(@url,'?'))">
45 <xsl:value-of select="@url"/>
46 </xsl:if>
47 <xsl:text> </xsl:text>
48 <xsl:value-of select="$server"/>
49 <xsl:text>/pub/lfs/conglomeration/</xsl:text>
50 <xsl:choose>
51 <!-- Fix some directories. Test against package2 to be sure that we
52 are matching the start of a package name, not a string in a patch name -->
53 <xsl:when test="contains($package2, 'bash')">
54 <xsl:text>bash/</xsl:text>
55 </xsl:when>
56 <xsl:when test="contains($package2, 'gcc')">
57 <xsl:text>gcc/</xsl:text>
58 </xsl:when>
59 <xsl:when test="contains($package2, 'glibc')">
60 <xsl:text>glibc/</xsl:text>
61 </xsl:when>
62 <xsl:when test="contains($package2, 'tcl')">
63 <xsl:text>tcl/</xsl:text>
64 </xsl:when>
65 <xsl:when test="contains($package2, 'uClibc')">
66 <xsl:text>uClibc/</xsl:text>
67 </xsl:when>
68 <xsl:when test="contains($package2, 'udev')">
69 <xsl:text>udev/</xsl:text>
70 </xsl:when>
71 <xsl:otherwise>
72 <xsl:value-of select="$dirname"/>
73 <xsl:text>/</xsl:text>
74 </xsl:otherwise>
75 </xsl:choose>
76 <xsl:value-of select="$package"/>
77 <xsl:text>&#x0a;</xsl:text>
78 </xsl:if>
79 </xsl:template>
80
81 <xsl:template name="package.name">
82 <xsl:param name="url"/>
83 <xsl:choose>
84 <xsl:when test="contains($url, '/')">
85 <xsl:call-template name="package.name">
86 <xsl:with-param name="url" select="substring-after($url, '/')"/>
87 </xsl:call-template>
88 </xsl:when>
89 <xsl:otherwise>
90 <xsl:choose>
91 <xsl:when test="contains($url, '?')">
92 <xsl:value-of select="substring-before($url, '?')"/>
93 </xsl:when>
94 <xsl:otherwise>
95 <xsl:value-of select="$url"/>
96 </xsl:otherwise>
97 </xsl:choose>
98 </xsl:otherwise>
99 </xsl:choose>
100 </xsl:template>
101
102</xsl:stylesheet>
Note: See TracBrowser for help on using the repository browser.