The right approach in terms of XSLT coding in my view is to write templates based XSLT code but as you have a single template doing it all start by replacing
<Input type="button">
<xsl:attribute name="id">
<xsl:value-of select="CountID"/>
</xsl:attribute>
<xsl:attribute name="name">
<xsl:value-of select="CountID"/>
</xsl:attribute>
<xsl:attribute name="onclick">
<xsl:text>on_change()</xsl:text>
</xsl:attribute>
<xsl:attribute name="value">Conclude</xsl:attribute>
</Input>
with
<input type="button" id="{CountID}" name="{CountID}" onclick="on_change(this.id);" value="Conclude"/>
then make the Javascript function take a parameter so instead of
var myVar = "<xsl:value-of select="CountID"/>";
<xsl:comment>
function on_change()
{
alert(myVar);
}
</xsl:comment>
simply use
<script type="text/javascript">
function on_change(id) {
alert(id);
}
</script>
That is all that is needed.