source: BLFS/xsl/bump.xsl@ d8add36

ablfs
Last change on this file since d8add36 was 63fc514, checked in by Pierre Labastie <pierre@…>, 13 years ago

Initial modificaiton of BLFS tools

  • Property mode set to 100644
File size: 2.1 KB
Line 
1<?xml version="1.0" encoding="ISO-8859-1"?>
2
3<!-- $Id: bump.xsl 21 2012-02-16 15:06:19Z labastie $ -->
4
5<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
6 version="1.0">
7
8 <xsl:param name="packages" select="'packages.xml'"/>
9 <xsl:param name="package" select="''"/>
10
11 <xsl:output
12 method="xml"
13 encoding="ISO-8859-1"
14 doctype-system="PACKDESC"/>
15
16 <xsl:template match="/">
17 <sublist>
18 <xsl:copy-of select="./sublist/name"/>
19 <xsl:apply-templates select=".//package"/>
20 <xsl:if test="not(.//package[string(name)=$package])">
21 <package>
22 <name><xsl:value-of select="$package"/></name>
23 <version><xsl:value-of select=
24 "document($packages)//package[string(name)=$package]/version"/>
25 </version>
26 </package>
27 </xsl:if>
28 </sublist>
29 </xsl:template>
30
31 <xsl:template match="package">
32 <xsl:choose>
33 <xsl:when test="string(name)=$package">
34 <package>
35 <name><xsl:value-of select="name"/></name>
36 <version><xsl:value-of select=
37 "document($packages)//package[string(name)=$package]/version"/>
38 </version>
39 </package>
40 </xsl:when>
41 <xsl:otherwise>
42 <xsl:copy-of select='.'/>
43 </xsl:otherwise>
44 </xsl:choose>
45 </xsl:template>
46
47 <xsl:template name="dirname">
48 <xsl:param name="filename" select="$packages"/>
49 <xsl:param name="dir" select="''"/>
50 <xsl:choose>
51 <xsl:when test="contains($filename,'/')">
52 <xsl:call-template name="dirname">
53 <xsl:with-param
54 name="filename"
55 select="substring-after($filename,'/')"/>
56 <xsl:with-param
57 name="dir"
58 select="concat(substring-before($filename,'/'),'/')"/>
59 </xsl:call-template>
60 </xsl:when>
61 <xsl:when test="not(contains($dir,'/'))">
62 <xsl:message>`packages' must be an absolute path</xsl:message>
63 </xsl:when>
64 <xsl:otherwise>
65 <xsl:value-of select="$dir"/>
66 </xsl:otherwise>
67 </xsl:choose>
68 </xsl:template>
69</xsl:stylesheet>
Note: See TracBrowser for help on using the repository browser.