The syntax of your if condition is correct, but your test path is probably not what you want. Remember that your if condition is nested inside a for-each, so your current context node will be a Card. I'm guessing you want this:
<xsl:if test="@CardID='5006'"></xsl:if>