gpt4 book ai didi

xslt - xsl 中的内联 JavaScript

转载 作者:行者123 更新时间:2023-12-04 15:42:27 25 4
gpt4 key购买 nike

我必须在 xsl 样式表文件中包含内联脚本,但问题是 xsl 尝试转换脚本并导致错误。

<script id="template-upload" type="text/x-tmpl">
{% for (var i=0, file; file=o.files[i]; i++) { %}
<tr class="template-upload fade">
<td class="preview"><span class="fade"></span></td>
<td class="name"><span>{%=file.name%}</span></td>
<td class="size"><span>{%=o.formatFileSize(file.size)%}</span></td>
{% if (file.error) { %}
<td class="error" colspan="2"><span class="label label-important">Error</span> {%=file.error%}</td>
{% } else if (o.files.valid && !i) { %}
<td>
<div class="progress progress-success progress-striped active" role="progressbar" aria-valuemin="0" aria-valuemax="100" aria-valuenow="0"><div class="bar" style="width:0%;"></div></div>
</td>
<td class="start">{% if (!o.options.autoUpload) { %}
<button class="btn">
<i class="icon-upload icon-white"></i>
<span>Start</span>
</button>
{% } %}</td>
{% } else { %}
<td colspan="2"></td>
{% } %}
<td class="cancel">{% if (!i) { %}
<button class="btn btn-danger">
<i class="icon-ban-circle icon-white"></i>
<span>Cancel</span>
</button>
{% } %}</td>
</tr>
{% } %}
</script>

有没有办法在xsl中使用内联脚本?

最佳答案

由于与符号 (&),您的 javascript 部分不是有效的 xml。为了避免解释您可以使用 CDATA 和disable-output-escaping 来避免转义。

<xsl:template match="/">
<script id="template-upload" type="text/x-tmpl">
<xsl:text disable-output-escaping="yes" >
<![CDATA[
...

]]>
</xsl:text>
</script>

关于xslt - xsl 中的内联 JavaScript,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/16518996/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com