おそらくもっとエレガントな方法があります (そして私は推測sum()します :) が、次のように兄弟を足し算で「折り畳む」ことによって機能します。終了条件は最後の兄弟 (つまり、後続のノードがない) です。
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
                version="1.0">
    <xsl:output method="xml" omit-xml-declaration="yes"/>
    <xsl:template match="/EmpCollection">
        <result>Result Is : <xsl:apply-templates select="Emp[1]"/>
        </result>
    </xsl:template>
    <xsl:template match="Emp[following-sibling::Emp]">
        <xsl:variable name="salThis">
            <xsl:value-of select="Sal"/>
        </xsl:variable>
        <xsl:variable name="salOthers">
            <xsl:apply-templates select="following-sibling::Emp[position()=1]"/>
        </xsl:variable>
        <xsl:value-of select="$salThis + $salOthers"/>
    </xsl:template>
    <!--Termination - the last employee just returns its salary value-->
    <xsl:template match="Emp[not(following-sibling::Emp)]">
        <xsl:value-of select="Sal"/>
    </xsl:template>
</xsl:stylesheet>
結果を与える:
<result>Result Is : 32300</result>
編集
あなたの質問をもう一度読んだ後、これはコードゴルフの質問ではないと思いますか? 以下は、ハードコーディングされた要素名を使用してこれを行うより簡単な方法です。これは、指定された従業員の給与を合計するようプロセッサに指示します。
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
                version="1.0">
    <xsl:output method="xml" omit-xml-declaration="yes"/>
    <xsl:template match="/EmpCollection">
        <result>
            Result Is : <xsl:value-of select="Emp[Name='Sai']/Sal + Emp[Name='Nari']/Sal + Emp[Name='Hari']/Sal + Emp[Name='Suri']/Sal"/>
        </result>
    </xsl:template>
</xsl:stylesheet>
sum()これにより、何が行われているかを簡単に理解できるようになります。
<xsl:template match="/EmpCollection">
    <result>
        Result Is : <xsl:value-of select="sum(Emp/Sal)"/>
    </result>
</xsl:template>
編集
カウントは単純です:
<xsl:template match="/EmpCollection">
    <result>
        <xsl:text>Count Is : </xsl:text>
        <xsl:value-of select="count(Emp)"/>
    </result>
</xsl:template>
なしでこれを行うcount()のはそれほど簡単ではありません。xsl:variables は一度割り当てられると変更できないことに注意してください(不変)。したがって、以下はまったく機能しません。
<xsl:template match="/EmpCollection">
    <xsl:variable name="count" select="0" />
    <xsl:for-each select="Emp">
        <!--NB : You can't do this. Variables are immutable - XSLT is functional -->
        <xsl:variable name="count" select="$count + 1"></xsl:variable>
    </xsl:for-each>
    <result>
        Result Is : <xsl:value-of select="$count"/>
    </result>
</xsl:template>
したがって、すべてのノードを「ループ」してから、 を使用position()して、これがシーケンスの最後のノードであるかどうかを判断できます。( を使用しましfor-eachたが、実際には use を使用する方がよいことに注意してくださいapply-template)
<xsl:template match="/EmpCollection">
    <result>
        <xsl:text>Count Is : </xsl:text>
        <xsl:for-each select="Emp">
            <xsl:if test="position() = last()">
                <xsl:number value="position()" format="1" />
            </xsl:if>
        </xsl:for-each>
    </result>
</xsl:template>
:(