Personally I wouldn't use the rich-text editor to insert JavaScript snippets, TinyMCE tries to format the code - I've had headaches with it!
If the property is only used for the JavaScript, then you could change the data-type to a "Textbox Multiple", (in your document-type), as that will sort the JavaScript literally.
I'm not sure putting the code within a comment block is going to solve your problem - the JavaScript wont run on in the web-browser, (because it is commented-out!)
Try removing the <xsl:comment> blocks, and leaving in the "disable-output-escaping=yes", and see if that works?
I really think you should use the "multiple text" datatype instead of using the RTE datatype for this. I think it's giving less of a headache since tinyMce will not bug you. You will just get the text. You should use the disable-output-escaping="yes" as Lee is saying when you fetch the data.
Output javascript from xslt
Hi all. I am newbie in Umbraco.
I have richtexteditor field in my datatype. I am write in this field code yandex metrika.
For example:
<script src="//mc.yandex.ru/metrika/watch.js" type="text/javascript"></script>
<div style="display:none;"><script type="text/javascript">
try { var yaCounter1121901 = new Ya.Metrika(1121901); } catch(e){}
</script></div>
<noscript><div style="position:absolute"><img src="//mc.yandex.ru/watch/1121901" alt="" /></div></noscript>
In my xslt file i try output this is code:
<xsl:value-of select="$node/data[@alias = 'YandexMetrika']"/>
but I do not get right result. Can you tell me where i'm wrong?
Sorry for my bad english.
And i use <xsl:output method="xml" omit-xml-declaration="yes"/>
Hi Pavel,
Personally I wouldn't use the rich-text editor to insert JavaScript snippets, TinyMCE tries to format the code - I've had headaches with it!
If the property is only used for the JavaScript, then you could change the data-type to a "Textbox Multiple", (in your document-type), as that will sort the JavaScript literally.
Your XSLT seems fine.
Let us know how you get on.
Cheers, Lee.
Try adding disable-output-escaping="yes" i.e.
<xsl:value-of select="$node/data[@alias = 'YandexMetrika']" disable-output-escaping="yes" />
Regards,
Kevin
Hi again. Thank you for your answers. I solve problem with append <xsl:comment> block.
<xsl:comment>
<xsl:value-of select="$node/data[@alias = 'YandexMetrika']" disable-output-escaping="yes"/>
</xsl:comment>
Hi Pavel,
I'm not sure putting the code within a comment block is going to solve your problem - the JavaScript wont run on in the web-browser, (because it is commented-out!)
Try removing the <xsl:comment> blocks, and leaving in the "disable-output-escaping=yes", and see if that works?
Cheers, Lee.
Hi Pavel
I really think you should use the "multiple text" datatype instead of using the RTE datatype for this. I think it's giving less of a headache since tinyMce will not bug you. You will just get the text. You should use the disable-output-escaping="yes" as Lee is saying when you fetch the data.
/Jan
Oh. I'm wrong. You rights, sorry. Thank you!
is working on a reply...