Blame SOURCES/fix-jing-simplified-rng.xsl

5706e2
5706e2
                xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
5706e2
                xmlns:rng="http://relaxng.org/ns/structure/1.0"
5706e2
                xmlns="http://relaxng.org/ns/structure/1.0"
5706e2
                exclude-result-prefixes="rng">
5706e2
<xsl:output format="xml" indent="yes"/>
5706e2
<xsl:strip-space elements="*"/>
5706e2
5706e2
<xsl:param name="filename-or-version" select="'99.99'"/>
5706e2
<xsl:variable name="version">
5706e2
    <xsl:variable name="version-local">
5706e2
        <xsl:choose>
5706e2
            <xsl:when test="starts-with($filename-or-version, 'pacemaker-')">
5706e2
                
5706e2
                              select="substring-after($filename-or-version, 'pacemaker-')"/>
5706e2
                <xsl:choose>
5706e2
                    <xsl:when test="contains(substring-after($version-tail, '.'), '.')">
5706e2
                        
5706e2
                                                  $version-tail,
5706e2
                                                  1,
5706e2
                                                  string-length($version-tail)
5706e2
                                                  -
5706e2
                                                  1
5706e2
                                                  -
5706e2
                                                  string-length(
5706e2
                                                      substring-after(
5706e2
                                                          substring-after(
5706e2
                                                              $version-tail,
5706e2
                                                              '.'
5706e2
                                                          ),
5706e2
                                                          '.'
5706e2
                                                      )
5706e2
                                                  )
5706e2
                                              )"/>
5706e2
                    </xsl:when>
5706e2
                    <xsl:otherwise>
5706e2
                        <xsl:value-of select="$version-tail"/>
5706e2
                    </xsl:otherwise>
5706e2
                </xsl:choose>
5706e2
            </xsl:when>
5706e2
            <xsl:otherwise>
5706e2
                <xsl:value-of select="$filename-or-version"/>
5706e2
            </xsl:otherwise>
5706e2
        </xsl:choose>
5706e2
    </xsl:variable>
5706e2
    <xsl:if test="number($version-local) = number('NaN')">
5706e2
        <xsl:message terminate="yes">
5706e2
            <xsl:value-of select="concat('Wrong number specification: ', $version-local)"/>
5706e2
        </xsl:message>
5706e2
    </xsl:if>
5706e2
    <xsl:value-of select="$version-local"/>
5706e2
</xsl:variable>
5706e2
<xsl:variable name="version-major">
5706e2
    <xsl:choose>
5706e2
        <xsl:when test="contains($version, '.')">
5706e2
            <xsl:value-of select="number(substring-before($version, '.'))"/>
5706e2
        </xsl:when>
5706e2
        <xsl:otherwise>
5706e2
            <xsl:value-of select="number($version)"/>
5706e2
        </xsl:otherwise>
5706e2
    </xsl:choose>
5706e2
</xsl:variable>
5706e2
<xsl:variable name="version-minor">
5706e2
    <xsl:value-of select="number(concat('0', substring-after($version, '.')))"/>
5706e2
</xsl:variable>
5706e2
5706e2
<xsl:template match="/rng:grammar">
5706e2
    <xsl:copy>
5706e2
        <xsl:copy-of select="@*"/>
5706e2
        <xsl:attribute name="datatypeLibrary">
5706e2
            <xsl:value-of select="'http://www.w3.org/2001/XMLSchema-datatypes'"/>
5706e2
        </xsl:attribute>
5706e2
        <xsl:apply-templates/>
5706e2
    </xsl:copy>
5706e2
</xsl:template>
5706e2
5706e2
5706e2
<xsl:template match="@ns[. = '']"/>
5706e2
5706e2
                         . = ''
5706e2
                         or
5706e2
                         . = 'http://www.w3.org/2001/XMLSchema-datatypes'
5706e2
                     ]"/>
5706e2
5706e2
5706e2
     of the file processed -->
5706e2
<xsl:template match="rng:attribute[@name = 'validate-with']/rng:choice/rng:value">
5706e2
    <xsl:choose>
5706e2
        
5706e2
                        and
5706e2
                        (
5706e2
                            number(
5706e2
                                substring-before(substring-after(text(), 'pacemaker-'), '.')
5706e2
                            ) > $version-major
5706e2
                            or
5706e2
                            (
5706e2
                                number(
5706e2
                                    substring-before(substring-after(text(), 'pacemaker-'), '.')
5706e2
                                ) = $version-major
5706e2
                                and
5706e2
                                number(
5706e2
                                    concat('0', substring-after(substring-after(text(), 'pacemaker-'), '.'))
5706e2
                                ) > $version-minor
5706e2
5706e2
                            )
5706e2
                        )"/>
5706e2
        <xsl:otherwise>
5706e2
            <xsl:copy>
5706e2
                <xsl:apply-templates select="@*|node()"/>
5706e2
            </xsl:copy>
5706e2
        </xsl:otherwise>
5706e2
    </xsl:choose>
5706e2
</xsl:template>
5706e2
5706e2
5706e2
     - https://github.com/ClusterLabs/pacemaker/commit/89f5177
5706e2
     - https://pagure.io/clufter/c/a3985ec -->
5706e2
<xsl:template match="*[name() != 'optional']/rng:ref[@name = 'status']">
5706e2
    <optional>
5706e2
        <xsl:copy>
5706e2
            <xsl:apply-templates select="@*|node()"/>
5706e2
        </xsl:copy>
5706e2
    </optional>
5706e2
</xsl:template>
5706e2
5706e2
5706e2
     of rsc_colocation are supported; see also:
5706e2
     - https://github.com/ClusterLabs/pacemaker/commit/30383cc
5706e2
     - https://pagure.io/clufter/c/abd2d45 (+ 53b8215) -->
5706e2
5706e2
                         rng:attribute[@name = 'score']
5706e2
                     ]">
5706e2
    <xsl:apply-templates select="rng:attribute[@name = 'score']"/>
5706e2
</xsl:template>
5706e2
5706e2
<xsl:template match="@*|node()">
5706e2
    <xsl:copy>
5706e2
        <xsl:apply-templates select="@*|node()"/>
5706e2
    </xsl:copy>
5706e2
</xsl:template>
5706e2
5706e2
</xsl:stylesheet>