金額の合計を意味していると思います。以下のようにxpathで行うことができます
  <xsl:template match="/xml">
    <xsl:value-of select="sum(test[normalize-space(BookID)='0061AB']/amount)"/>
  </xsl:template>
編集
変数を使用するか、前の質問に対する私の回答に従って呼び出しテンプレートを使用して、BookID をパラメーター化できます。
以下のスタイルシート
  <xsl:template match="/xml">
    <xsl:variable name="bookID" select="'0061AB'"/>
    <xsl:value-of select="sum(test[normalize-space(BookID)=$bookID]/amount)"/>
  </xsl:template>
編集#2
個別の要素をグループ化し、合計を集計した後のようです。
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
    <xsl:output method="xml" indent="yes"/>
    <!-- the identity template -->
    <xsl:template match="@* | node()">
        <xsl:copy>
            <xsl:apply-templates select="@* | node()" />
        </xsl:copy>
    </xsl:template>
    <xsl:template match="test">
        <xsl:variable name="bookID" select="normalize-space(BookID/text())" />
        <xsl:if test="not(preceding-sibling::test[normalize-space(BookID/text())=$bookID])">
            <test>
                <xsl:apply-templates />
            </test>
        </xsl:if>
        <!--Else `eat` the duplicate test node-->
    </xsl:template>
    <xsl:template match="amount">
        <amount>
            <xsl:variable name="bookID" select="normalize-space(../BookID/text())" />
            <xsl:value-of select="sum(//test[normalize-space(BookID/text())=$bookID]/amount)"/>
        </amount>
    </xsl:template>
</xsl:stylesheet>
出力を生成します
<xml>
    <test>
        <BookID>
            0061AB
        </BookID>
        <amount>18</amount>
    </test>
    <test>
        <BookID>
            0062CD
        </BookID>
        <amount>2</amount>
    </test>
</xml>
よくある質問をお読みください。
編集 3
このスタイルシートは、最新の要件を満たします。
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
    <xsl:output method="xml" indent="yes" omit-xml-declaration="yes"/>
    <!-- the identity template -->
    <xsl:template match="@* | node()">
        <xsl:copy>
            <xsl:apply-templates select="@* | node()" />
        </xsl:copy>
    </xsl:template>
    <xsl:template match="test">
        <xsl:variable name="bookID" select="normalize-space(BookID/BookID1/BookID2/text())" />
        <xsl:if test="not(preceding-sibling::test[normalize-space(BookID/BookID1/BookID2/text())=$bookID])">
            <test>
                <xsl:apply-templates />
            </test>
        </xsl:if>
        <!--Else `eat` the duplicate test node-->
    </xsl:template>
    <xsl:template match="amount">
        <amount>
            <xsl:variable name="bookID" select="normalize-space(../BookID/BookID1/BookID2/text())" />
            <xsl:value-of select="sum(//test[normalize-space(BookID/BookID1/BookID2/text())=$bookID]/amount)"/>
        </amount>
    </xsl:template>
</xsl:stylesheet>