If you want to embed JavaScript in your ???2html.xsl, you can use the following technique:
<script type="text/javascript"> <xsl:comment> <![CDATA[ log("mail", ]]> "<xsl:copy-of select="$page"/>" <![CDATA[ ); ]]> </xsl:comment> </script>
This script calls a function "log()" with a fixed parameter and a parameter build from a variable $page.
The function is defined in an external script file, which can be included with
<xsl:element name="script"> <xsl:attribute name="type">text/javascript</xsl:attribute> <xsl:attribute name="src">/resources/scripts/logger.js</xsl:attribute> </xsl:element>
or
<script type="text/javascript" src="/resources/scripts/logger.js" />
in the html <head>.