So here is a solution, but without using xsl:number, that usually gives me too much of a headache, but since you have been using level="any" it doesn't really matter:
<xsl:template match="note">
<!--
counts unique preceding notes starting from first note with current @name
-->
<xsl:variable name="number"
select="count((//note[@name=current()/@name])[1]/preceding::note[not(@name=../preceding::note/@name)]) + 1"/>
<xsl:choose>
<!-- if there is no preceding note with same name -->
<xsl:when test="not(preceding::note/@name=current()/@name)">
<fo:footnote>
<fo:inline baseline-shift="super" font-size="75%" color="red">(<xsl:value-of
select="$number"/>)</fo:inline>
<fo:footnote-body>
<fo:block color="blue">
<xsl:if test="@margin-left">
<xsl:attribute name="margin-left">
<xsl:value-of select="@margin-left"/>
</xsl:attribute>
</xsl:if>
<fo:inline baseline-shift="super" font-size="75%">(<xsl:value-of select="$number"
/>)</fo:inline>
<xsl:value-of select="."/>
</fo:block>
</fo:footnote-body>
</fo:footnote>
</xsl:when>
<xsl:otherwise>
<fo:inline baseline-shift="super" font-size="75%" color="red">(<xsl:value-of
select="$number"/>)</fo:inline>
</xsl:otherwise>
</xsl:choose>
</xsl:template>