source: common/packages.xsl@ de67016

ablfs-more legacy trunk
Last change on this file since de67016 was 7b33f40, checked in by Pierre Labastie <pierre@…>, 4 years ago

Use an XPath expression to select <para> that contains packages with right
attributes in packages.xsl, rather than an <xsl:if>.

  • Property mode set to 100644
File size: 2.3 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 <!-- The system for LFS: sysv of systemd -->
20 <xsl:param name="revision" select="'sysv'"/>
21
22 <xsl:template match="/">
23 <xsl:apply-templates
24 select="//varlistentry[(@condition=$model or not(@condition)) and
25 (@revision=$revision or not(@revision)) and
26 (@vendor=$kernel or not(@vendor))]
27 //para[contains(string(),'Download:')]"/>
28 <xsl:if test="$pkgmngt='y'">
29 <xsl:apply-templates
30 select="document('packageManager.xml')//sect1[@id='package']//para"/>
31 </xsl:if>
32 </xsl:template>
33
34 <xsl:template match="para">
35 <xsl:call-template name="package_name">
36 <xsl:with-param name="url" select="ulink/@url"/>
37 </xsl:call-template>
38 </xsl:template>
39
40 <xsl:template name="package_name">
41 <xsl:param name="url" select="'foo'"/>
42 <xsl:variable name="sub-url" select="substring-after($url,'/')"/>
43 <xsl:choose>
44 <xsl:when test="contains($sub-url,'/') and
45 not(substring-after($sub-url,'/')='')">
46 <xsl:call-template name="package_name">
47 <xsl:with-param name="url" select="$sub-url"/>
48 </xsl:call-template>
49 </xsl:when>
50 <xsl:otherwise>
51 <xsl:choose>
52 <xsl:when test="contains($sub-url,'.patch')"/>
53 <xsl:when test="contains($sub-url,'?')">
54 <xsl:value-of select="substring-before($sub-url,'?')"/>
55 <xsl:text>&#xA;</xsl:text>
56 </xsl:when>
57 <xsl:when test="contains($sub-url,'/')">
58 <xsl:value-of select="substring-before($sub-url,'/')"/>
59 <xsl:text>&#xA;</xsl:text>
60 </xsl:when>
61 <xsl:otherwise>
62 <xsl:value-of select="$sub-url"/>
63 <xsl:text>&#xA;</xsl:text>
64 </xsl:otherwise>
65 </xsl:choose>
66 </xsl:otherwise>
67 </xsl:choose>
68 </xsl:template>
69
70</xsl:stylesheet>
Note: See TracBrowser for help on using the repository browser.