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

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