source: common/packages.xsl@ 2ce3688

2.4 ablfs-more legacy new_features trunk
Last change on this file since 2ce3688 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
RevLine 
[a160d86]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
[139c34e]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
[7072e1f]16 <!-- Should we include a package manager -->
17 <xsl:param name="pkgmngt" select="n"/>
18
[a160d86]19 <xsl:template match="/">
20 <xsl:apply-templates select="//para"/>
[7072e1f]21 <xsl:if test="$pkgmngt='y'">
22 <xsl:apply-templates
23 select="document('packageManager.xml')//sect1[@id='package']//para"/>
24 </xsl:if>
[a160d86]25 </xsl:template>
26
27 <xsl:template match="para">
[139c34e]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]))">
[a160d86]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"/>
[7072e1f]41 <xsl:variable name="sub-url" select="substring-after($url,'/')"/>
[a160d86]42 <xsl:choose>
[ff9938f]43 <xsl:when test="contains($sub-url,'/') and
44 not(substring-after($sub-url,'/')='')">
[a160d86]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,'?')"/>
[7072e1f]54 <xsl:text>&#xA;</xsl:text>
[a160d86]55 </xsl:when>
[ff9938f]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>
[a160d86]60 <xsl:otherwise>
61 <xsl:value-of select="$sub-url"/>
[7072e1f]62 <xsl:text>&#xA;</xsl:text>
[a160d86]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.