I would write some templates to handle the two cases:
Code:
<xsl:template match="img[contains(@src,'http://cup.com')]">
<img src="{concat('http://dip.com',substring-after(@src,'http://cup.com'))}"/>
</xsl:template>
<xsl:template match="img"><xsl:copy-of select="."/></xsl:template>
Then change the line with n_content to use xsl:apply-templates instead of xsl:value-of:
Code:
<xsl:apply-templates select="n_content"/>