source: common/packages.xsl@ 2e1c1c3

ablfs-more legacy trunk
Last change on this file since 2e1c1c3 was c9598f2, checked in by Pierre Labastie <pierre@…>, 8 years ago

Adaptation for merged LFS books. A few typos with no consequence are corrected too.

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