The custom JavaScript file is included in the output as follows:
<xsl:template name="producePageScript">
<xsl:param name="interactinfo"/>
<xsl:param name="custom"/>
<xsl:call-template name="producePageScript_default">
<xsl:with-param name="interactinfo" select="$interactinfo"/>
<xsl:with-param name="custom" select="$custom"/>
</xsl:call-template>
<script type="text/javascript" src="js/jquery.caret.min.js">
<xsl:value-of select="$empty"/>
</script>
<script type="text/javascript" src="js/customnumberquestion.js">
<xsl:value-of select="$empty"/>
</script>
</xsl:template>
It produces the standard JavaScript by calling the default template producePageScript and adds two script includes after this. This order is important, because otherwise the registration of the new class with the itpelementfactory would not prevail.