source: common/packages.xsl@ 56d8426

2.4 ablfs-more legacy new_features trunk
Last change on this file since 56d8426 was ff9938f, checked in by Pierre Labastie <pierre@…>, 11 years ago

Account for the possibility of a trailing slash in an url in pacakges.xsl

  • Property mode set to 100644
File size: 2.2 KB
Line 
1<?xml version='1.0' encoding='ISO-8859-1'?>
2
3<!-- $Id$ -->
4
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 libc model used for HLFS -->
11 <xsl:param name="model" select="glibc"/>
12
13 <!-- The kernel series used for HLFS -->
14 <xsl:param name="kernel" select="2.6"/>
15
16 <!-- Should we include a package manager -->
17 <xsl:param name="pkgmngt" select="n"/>
18
19 <xsl:template match="/">
20 <xsl:apply-templates select="//para"/>
21 <xsl:if test="$pkgmngt='y'">
22 <xsl:apply-templates
23 select="document('packageManager.xml')//sect1[@id='package']//para"/>
24 </xsl:if>
25 </xsl:template>
26
27 <xsl:template match="para">
28 <xsl:if test="contains(string(),'Download:') and
29 (ancestor::varlistentry[@condition=$model]
30 or not(ancestor::varlistentry[@condition])) and
31 (ancestor::varlistentry[@vendor=$kernel]
32 or not(ancestor::varlistentry[@vendor]))">
33 <xsl:call-template name="package_name">
34 <xsl:with-param name="url" select="ulink/@url"/>
35 </xsl:call-template>
36 </xsl:if>
37 </xsl:template>
38
39 <xsl:template name="package_name">
40 <xsl:param name="url" select="foo"/>
41 <xsl:variable name="sub-url" select="substring-after($url,'/')"/>
42 <xsl:choose>
43 <xsl:when test="contains($sub-url,'/') and
44 not(substring-after($sub-url,'/')='')">
45 <xsl:call-template name="package_name">
46 <xsl:with-param name="url" select="$sub-url"/>
47 </xsl:call-template>
48 </xsl:when>
49 <xsl:otherwise>
50 <xsl:choose>
51 <xsl:when test="contains($sub-url,'.patch')"/>
52 <xsl:when test="contains($sub-url,'?')">
53 <xsl:value-of select="substring-before($sub-url,'?')"/>
54 <xsl:text>&#xA;</xsl:text>
55 </xsl:when>
56 <xsl:when test="contains($sub-url,'/')">
57 <xsl:value-of select="substring-before($sub-url,'/')"/>
58 <xsl:text>&#xA;</xsl:text>
59 </xsl:when>
60 <xsl:otherwise>
61 <xsl:value-of select="$sub-url"/>
62 <xsl:text>&#xA;</xsl:text>
63 </xsl:otherwise>
64 </xsl:choose>
65 </xsl:otherwise>
66 </xsl:choose>
67 </xsl:template>
68
69</xsl:stylesheet>
Note: See TracBrowser for help on using the repository browser.