简体   繁体   English

如何在XSL文件中添加JavaScript脚本标签

[英]How to add javascript script tag in XSL file

I want to add code shown below in my XSL but it is not displaying properly when I generate it in HTML. 我想在我的XSL中添加下面显示的代码,但是当我在HTML中生成它时,它无法正确显示。

<head>
  <script src='https://js.dmtry.com/channel.js#gid:3299;advid:899;pid:389827'> </script>
</head>

The script tag is not closing properly when generated in HTML. 在HTML中生成时,脚本标记未正确关闭。

Perhaps you are saying you are getting this as the output: 也许您是说您正在获得此作为输出:

<script src="https://js.dmtry.com/channel.js#gid:3299;advid:899;pid:389827"/>

When, actually, you are expecting this: 实际上,您何时期望这样:

<script src="https://js.dmtry.com/channel.js#gid:3299;advid:899;pid:389827"></script>

If so, try specifying the output method in your XSLT as "html", like so: 如果是这样,请尝试在XSLT中将输出方法指定为“ html”,如下所示:

<xsl:output method="html" />

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 如何在脚本标签内将 xsl 变量作为参数传递给 javascript function? - How to pass xsl variable as a parameter to javascript function within script tag? 如何将脚本添加到<head>使用javascript标记 - How to add script to <head> tag using javascript 如何使用javascript动态添加脚本标签并检测脚本是否无法加载文件? - How to add a script tag dynamically using javascript and detect if the script failed to load the file? 如何在 React/JSX 文件中添加脚本标签? - How to add script tag in React/JSX file? 如何加载没有脚本标记的Javascript文件? - How to load a Javascript file without Script tag? 如何在包含 jquery.js 之后但在仅使用 javascript 结束 body 标记之前在 html 文件中添加脚本标记? - How to add script tag in the html file after where jquery.js is included but before ending body tag using javascript only? 如何在另一个xsl中包含带有js脚本标签的xsl文件? - How to include xsl file with js script tags in another xsl? 如何在javascript的html头标记中动态添加脚本值 - how to add a script value dynamically in html head tag in javascript 如何在JavaScript中添加动态创建的脚本标签属性? - How to add dynamically created script tag attribute in JavaScript? Javascript如何在没有源文件的情况下动态创建脚本标记? - Javascript how to create a script tag dynamically without the source file?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM