source: common/packages.xsl@ b3825c3

ablfs-more legacy trunk
Last change on this file since b3825c3 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
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 -->
[c9598f2]11 <xsl:param name="model" select="'glibc'"/>
[139c34e]12
13 <!-- The kernel series used for HLFS -->
[c9598f2]14 <xsl:param name="kernel" select="'2.6'"/>
[139c34e]15
[c9598f2]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'"/>
[7072e1f]21
[a160d86]22 <xsl:template match="/">
[7b33f40]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:')]"/>
[7072e1f]28 <xsl:if test="$pkgmngt='y'">
29 <xsl:apply-templates
30 select="document('packageManager.xml')//sect1[@id='package']//para"/>
31 </xsl:if>
[a160d86]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">
[7b33f40]41 <xsl:param name="url" select="'foo'"/>
[7072e1f]42 <xsl:variable name="sub-url" select="substring-after($url,'/')"/>
[a160d86]43 <xsl:choose>
[ff9938f]44 <xsl:when test="contains($sub-url,'/') and
45 not(substring-after($sub-url,'/')='')">
[a160d86]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,'?')"/>
[7072e1f]55 <xsl:text>&#xA;</xsl:text>
[a160d86]56 </xsl:when>
[ff9938f]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>
[a160d86]61 <xsl:otherwise>
62 <xsl:value-of select="$sub-url"/>
[7072e1f]63 <xsl:text>&#xA;</xsl:text>
[a160d86]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.