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

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