summaryrefslogtreecommitdiffstats
path: root/packaging/doc-version.xsl
blob: 68e1a4a439d41911d89e5fc4c995b7875d63505e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
<!-- 

Extract version number for latest revision from rpm-info.xml.
Optional stringparam "role" allows querying of appropriate revision type.

-->

<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
  <xsl:output encoding="UTF-8" indent="no" method="text"/>

  <xsl:param name="role" select="'doc'"/>

  <xsl:template match="/">
    <xsl:choose>
      <xsl:when test="$role='rpm'">
	<xsl:choose>
	  <xsl:when test="/rpm-info/changelog/revision[1]/@role='doc'">
	    <xsl:text>0</xsl:text>
	  </xsl:when>
	  <xsl:otherwise>
	    <xsl:value-of
	      select="/rpm-info/changelog/revision[@role=$role][1]/@number"/>
	  </xsl:otherwise>
	</xsl:choose>
      </xsl:when>
      <xsl:otherwise>
	<xsl:value-of
	  select="/rpm-info/changelog/revision[@role=$role][1]/@number"/>
      </xsl:otherwise>
    </xsl:choose>
  </xsl:template>
</xsl:stylesheet>