Press Ctrl / CMD + C to copy this to your clipboard.
This post will be reported to the moderators as potential spam to be looked at
Hi,
I want to output the following HTML and javascript code from a xslt file, but I didn't succed. Does some one have a suggestion?
<p id="audioplayer_1">
Alternative content</p>
<script type="text/javascript"> AudioPlayer.embed("audioplayer_1", { soundFile: "/audio/track1.mp3" });</script>
Kind regards
Can you try wrapping that as
<xsl:text disable-output-escaping="yes"><![CDATA[<script type="text/javascript">AudioPlayer.embed("audioplayer_1", { soundFile: "/audio/track1.mp3" });</script>]]></xsl:text>
(not sure if that would work tho...)
Cheers,
/Dirk
Hy Dirk,
The following text is send to my browser. Somehow the < characters are replaced with <.
<script type="text/javascript">AudioPlayer.embed("audioplayer_1",{ soundFile: "/audio/track1.mp3" });</script>}
Ok, just tested that on a local install, don't have that issue, so in theory that should work...
Did you set disable-output-escaping="yes", as when omitting this, it will be sent to browser as you've experienced...
Hi Bas,
How are you doing the output - I don't see why your initial example would fail, if included as literal output from a template, e.g.:
<xsl:template match="/"> <p id="audioplayer_1"> Alternative content </p> <script type="text/javascript"> AudioPlayer.embed("audioplayer_1", { soundFile: "/audio/track1.mp3" }); </script> </xsl:template>
Are you by any chance, creating the content programmatically?
/Chriztian
Another potential issue that could mess things up... be sure your xslt is set to output xml, rather than html, text, or something else.
<xsl:output method="xml" omit-xml-declaration="yes"/>
If you still can't get it working, please paste in your entire xslt file for us to look at.
cheers,doug.
Hi Douglas,
I use a variable to output the HTML and forgot to add omit-xml-declaration="yes".
Thanks!
Regards
is working on a reply...
Write your reply to:
Upload image
Image will be uploaded when post is submitted
Javascript from XSLT
Hi,
I want to output the following HTML and javascript code from a xslt file, but I didn't succed. Does some one have a suggestion?
Kind regards
Can you try wrapping that as
(not sure if that would work tho...)
Cheers,
/Dirk
Hy Dirk,
The following text is send to my browser. Somehow the < characters are replaced with <.
Ok, just tested that on a local install, don't have that issue, so in theory that should work...
Did you set disable-output-escaping="yes", as when omitting this, it will be sent to browser as you've experienced...
Cheers,
/Dirk
Hi Bas,
How are you doing the output - I don't see why your initial example would fail, if included as literal output from a template, e.g.:
Are you by any chance, creating the content programmatically?
/Chriztian
Another potential issue that could mess things up... be sure your xslt is set to output xml, rather than html, text, or something else.
If you still can't get it working, please paste in your entire xslt file for us to look at.
cheers,
doug.
Hi Douglas,
I use a variable to output the HTML and forgot to add omit-xml-declaration="yes".
Thanks!
Regards
is working on a reply...