Are you able to use jQuery? If so you could use getScript()
:
http://api.jquery.com/jQuery.getScript/
$.getScript(mylink, function() {
// do something using the JS that was loaded.
});
Are you able to use jQuery? If so you could use getScript()
:
http://api.jquery.com/jQuery.getScript/
$.getScript(mylink, function() {
// do something using the JS that was loaded.
});
Try:
(function(d){
var file = 'yourJS.js';
var ref = d.getElementsByTagName('script')[0];
var js = d.createElement('script');
js.src = file;
ref.parentNode.insertBefore(js, ref);
}(document));
What this does:
<xsl:variable name="Path" select="/root/folder/"></xsl:variable> <!-- Global path variable. -->
<xsl:variable name="myScriptPath" select="concat($Path, 'myScript.js')"></xsl:variable> <!-- Relative script path variable. -->
<script src="{$myScriptPath}"/> <!-- Attach script. -->