My Javascript is very rusty so I'll leave that part to others, but before you do anything else, please change this code:
<xsl:text disable-output-escaping="yes"><![CDATA[<input type="button" id="]]></xsl:text>
<xsl:value-of select="TEST/Button/id"/>
<xsl:text disable-output-escaping="yes"><![CDATA[" value="]]></xsl:text>
<xsl:value-of select="TEST/Button/Text"/>
<xsl:text disable-output-escaping="yes"><![CDATA["]]></xsl:text>
This really isn't the way to write XSLT. disable-output-escaping is a last resort, to be used only cases where for some reason your input isn't properly marked up or you need to generate non-standard HTML or XML. And it doesn't work in all environments, because it relies on the output being serialized (which doesn't happen in Firefox, for example). The code you want is much simpler:
<html>
<body>
<input type="button"
id="{TEST/Button/id}"
value="{Test/Button/Text}"/>
</body>
</html>
Michael Kay
http://www.saxonica.com/
Author, XSLT Programmer's Reference and XPath 2.0 Programmer's Reference