This repository has been archived on 2024-10-17. You can view files and clone it, but cannot push or open issues or pull requests.
MahiroOS-jhalfs/BLFS/xsl/bump.xsl

58 lines
1.6 KiB
XML
Raw Normal View History

2012-02-22 18:09:47 +01:00
<?xml version="1.0" encoding="ISO-8859-1"?>
<!-- $Id: bump.xsl 21 2012-02-16 15:06:19Z labastie $ -->
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
version="1.0">
<xsl:param name="packages" select="'packages.xml'"/>
<xsl:param name="package" select="''"/>
2012-03-05 18:33:11 +01:00
<xsl:param name="version" select="'N'"/>
<xsl:variable name="vers">
<xsl:choose>
<xsl:when test="$version='N'">
<xsl:value-of select=
"document($packages)//*[self::package or self::module]
[string(name)=$package]/version"/>
2012-03-05 18:33:11 +01:00
</xsl:when>
<xsl:otherwise>
<xsl:value-of select="$version"/>
</xsl:otherwise>
</xsl:choose>
</xsl:variable>
2012-02-22 18:09:47 +01:00
<xsl:output
method="xml"
encoding="ISO-8859-1"
doctype-system="PACKDESC"/>
<xsl:template match="/">
<sublist>
<xsl:copy-of select="./sublist/name"/>
<xsl:apply-templates select=".//package"/>
<xsl:if test="not(.//package[string(name)=$package])">
<package>
<name><xsl:value-of select="$package"/></name>
2012-03-05 18:33:11 +01:00
<version><xsl:value-of select="$vers"/></version>
2012-02-22 18:09:47 +01:00
</package>
</xsl:if>
</sublist>
</xsl:template>
<xsl:template match="package">
<xsl:choose>
<xsl:when test="string(name)=$package">
<package>
<name><xsl:value-of select="name"/></name>
2012-03-05 18:33:11 +01:00
<version><xsl:value-of select="$vers"/></version>
2012-02-22 18:09:47 +01:00
</package>
</xsl:when>
<xsl:otherwise>
<xsl:copy-of select='.'/>
</xsl:otherwise>
</xsl:choose>
</xsl:template>
</xsl:stylesheet>