You need two incompatible formats in format-number(), hence, you have to test the number to determine which to use.
[1] Script a named template, say, "format-number-ext"
[tt]
<xsl:template name="format-number-ext">
<xsl

aram name="val" />
<xsl:choose>
<xsl:when test="$val mod 1 = 0">
<xsl:value-of select="format-number($val,'###,###')" />
</xsl:when>
<xsl

therwise>
<xsl:value-of select="format-number($val,'###,###.00')" />
</xsl

therwise>
</xsl:choose>
</xsl:template>
[/tt]
[2] Use it when needed.
[tt] [green]<!--
Replacing every occurence of this, for instance
<xsl:value-of select="format-number(@price,'###,###.00')" />
by the following line.
-->[/green]
<xsl:call-template name="format-number-ext">
<xsl:with-param select="@price" />
</xsl:call-template>
[/tt]