File: version-greater-or-equal.xsl

package info (click to toggle)
gtk-doc 1.15-2
  • links: PTS
  • area: main
  • in suites: squeeze
  • size: 5,576 kB
  • ctags: 266
  • sloc: xml: 16,117; sh: 10,619; perl: 7,967; ansic: 509; makefile: 434; lisp: 137
file content (54 lines) | stat: -rw-r--r-- 1,779 bytes parent folder | download | duplicates (10)
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
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
<?xml version='1.0'?> <!--*- mode: xml -*-->
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
                version="1.0"
                xmlns="http://www.w3.org/TR/xhtml1/transitional"
                exclude-result-prefixes="#default">
 <xsl:template name="version-greater-or-equal">
  <xsl:param name="ver1"></xsl:param>
  <xsl:param name="ver2"></xsl:param>
  <xsl:variable name="vp1">
    <xsl:choose>
      <xsl:when test="contains($ver1, '.')">
        <xsl:value-of select="substring-before($ver1, '.')"/>
      </xsl:when>
      <xsl:otherwise>
        <xsl:value-of select="$ver1"/>
      </xsl:otherwise>
    </xsl:choose>
  </xsl:variable>
  <xsl:variable name="vp2">
    <xsl:choose>
      <xsl:when test="contains($ver2, '.')">
        <xsl:value-of select="substring-before($ver2, '.')"/>
      </xsl:when>
      <xsl:otherwise>
        <xsl:value-of select="$ver2"/>
      </xsl:otherwise>
    </xsl:choose>
  </xsl:variable>
  <xsl:choose>
    <xsl:when test="$vp1 &gt; $vp2">
      1
    </xsl:when>
    <xsl:when test="$vp1 &lt; $vp2">
      0
    </xsl:when>
    <xsl:when test="$vp1 = $vp2">
      <xsl:choose>
        <xsl:when test="contains($ver1, '.') and contains($ver2, '.')">
          <xsl:call-template name="version-greater-or-equal">
            <xsl:with-param name="ver1" select="substring-after($ver1, '.')"/>
            <xsl:with-param name="ver2" select="substring-after($ver2, '.')"/>
          </xsl:call-template>
	</xsl:when>
        <xsl:when test="contains($ver2, '.')">
	   0
	</xsl:when>
	<xsl:otherwise>
	   1
	</xsl:otherwise>
      </xsl:choose>
    </xsl:when>
  </xsl:choose>                                  
</xsl:template>                                                                 
</xsl:stylesheet>