<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0" xmlns:dyn="http://exslt.org/dynamic" extension-element-prefixes="dyn">

    <xsl:variable name="openRuns">
        <xsl:choose>
            <xsl:when test="/Root/Form/RoyaltyRunStatus/CanEdit = 0">1</xsl:when>
            <xsl:otherwise>0</xsl:otherwise>
        </xsl:choose>
    </xsl:variable>

    <xsl:variable name="openUSRuns">
        <xsl:choose>
            <xsl:when test="/Root/Form/RoyaltyRunStatus/USMechanicalRuns/CanEdit = 0">1</xsl:when>
            <xsl:otherwise>0</xsl:otherwise>
        </xsl:choose>
    </xsl:variable>

    <xsl:variable name="openUKRuns">
        <xsl:choose>
            <xsl:when test="/Root/Form/RoyaltyRunStatus/UKMechanicalRuns/CanEdit = 0">1</xsl:when>
            <xsl:otherwise>0</xsl:otherwise>
        </xsl:choose>
    </xsl:variable>

    <xsl:variable name="openCARuns">
        <xsl:choose>
            <xsl:when test="/Root/Form/RoyaltyRunStatus/CAMechanicalRuns/CanEdit = 0">1</xsl:when>
            <xsl:otherwise>0</xsl:otherwise>
        </xsl:choose>
    </xsl:variable>

    <xsl:variable name="openArtistRuns">
        <xsl:choose>
            <xsl:when test="/Root/Form/RoyaltyRunStatus/ArtistRuns/CanEdit = 0">1</xsl:when>
            <xsl:otherwise>0</xsl:otherwise>
        </xsl:choose>
    </xsl:variable>

    <xsl:variable name="openLabelRuns">
        <xsl:choose>
            <xsl:when test="/Root/Form/RoyaltyRunStatus/LabelRuns/CanEdit = 0">1</xsl:when>
            <xsl:otherwise>0</xsl:otherwise>
        </xsl:choose>
    </xsl:variable>


    <xsl:template name="openRunStatusMessage">
            <xsl:if test="$openRuns &gt; 0">
                <xsl:call-template name="openRunMessageHelper">
                    <xsl:with-param name="artistRuns" select="Form/RoyaltyRunStatus/ArtistRuns/HasOpenRuns" />
                    <xsl:with-param name="labelRuns" select="Form/RoyaltyRunStatus/LabelRuns/HasOpenRuns" />
                    <xsl:with-param name="ukMechRuns" select="Form/RoyaltyRunStatus/UKMechanicalRuns/HasOpenRuns" />
                    <xsl:with-param name="usMechRuns" select="Form/RoyaltyRunStatus/USMechanicalRuns/HasOpenRuns" />
                    <xsl:with-param name="caMechRuns" select="Form/RoyaltyRunStatus/CAMechanicalRuns/HasOpenRuns" />
                </xsl:call-template>
            </xsl:if>
    </xsl:template>



</xsl:stylesheet>
