If you form a string from the set, you could use concat() to check whether the variable value is included.
<xsl:if test="contains('7 8 9', $k)"> <!-- Do something --> </xsl:if>