Reputation: 235
I'm having major trouble to output a document.write() javascript through my XSL page. (It's part of a 3rd party external tracking code snippet)
My desired output is:
document.write('<sc'+'ript src="'+'http'+(document.location.protocol=='https:'?'s':'')+'://'+ia_link+'"></sc'+'ript>');
An this is my complete Code:
<script language="JavaScript" type="text/javascript">
var url="someurl.js";
var blablabla="some-dynamic-values";
var ia_link=url+'?parameter='+blablabla;
</script>
<script>
<xsl:text disable-output-escaping="yes"><![CDATA[document.write('<script type="text/javascript" src="//:'+ia_link+'"></script>')]]></xsl:text>
</script>
<noscript>
<img src="http://url.php?blablabla=some-dynamic-values" width="1" height="1" />
</noscript>
I've tried several things outoutting the document.write() element...with the above <xsl:text disable-output-escaping="yes">
not-working solution, the html gets outputted corrupted (two </script>
tags)
--> How to output the document.write with the script tags correctly?
Upvotes: 1
Views: 1150
Reputation: 167706
Which browsers do you target? Mozilla browsers like Firefox or SeaMonkey are known not to support document.write
in the HTML result of a client-side XSLT transformation: https://developer.mozilla.org/en/docs/XSL_Transformations_in_Mozilla_FAQ#What_about_document.write.3F
Upvotes: 2