Nimbin[12]?Mirrors & Forks / jhalfs / BLFS/xsl/bump.xsl

jhalfs git · trunk

jhalfs LFS build automation (mirror)

lfs mirror bash · first commit 2005-09-11 · last commit 2024-02-13 (2 years ago) · synced 3 days ago · upstream: git.linuxfromscratch.org/jhalfs

Python 78.4% Shell 19.8% Makefile 1.8%
git clone https://git.christianimmanuel.de/mirrors-forks/jhalfs.gitwget https://git.christianimmanuel.de/mirrors-forks/jhalfs/archive/jhalfs.tar.gz
BLFS/xsl/bump.xsl 1.8 KB · 66 lines raw
<?xml version="1.0" encoding="ISO-8859-1"?>

<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="''"/>
  <xsl:param name="version" select="'N'"/>

  <xsl:variable name="realpackage">
    <xsl:choose>
      <xsl:when test="contains($package, '-pass1')">
        <xsl:copy-of select="substring-before($package, '-pass1')"/>
      </xsl:when>
      <xsl:otherwise>
        <xsl:copy-of select="$package"/>
      </xsl:otherwise>
    </xsl:choose>
  </xsl:variable>

  <xsl:variable name="vers">
    <xsl:choose>
      <xsl:when test="$version='N'">
        <xsl:value-of select=
            "document($packages)//*[self::package or self::module]
                                   [string(name)=$realpackage]/version"/>
      </xsl:when>
      <xsl:otherwise>
        <xsl:copy-of select="$version"/>
      </xsl:otherwise>
    </xsl:choose>
  </xsl:variable>

  <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:copy-of select="$package"/></name>
          <version><xsl:copy-of select="$vers"/></version>
        </package>
      </xsl:if>
    </sublist>
  </xsl:template>

  <xsl:template match="package">
    <xsl:choose>
      <xsl:when test="string(name)=$package">
        <package>
          <name><xsl:copy-of select="$package"/></name>
          <version><xsl:copy-of select="$vers"/></version>
        </package>
      </xsl:when>
      <xsl:otherwise>
        <xsl:copy-of select='.'/>
      </xsl:otherwise>
    </xsl:choose>
  </xsl:template>

</xsl:stylesheet>