我试过以下代码:
<xsl:variable name="xx" select="'40967.6424503935'"/>
<script type="text/javascript">
time({$xx});
</script>
Run Code Online (Sandbox Code Playgroud)
我的目的是通过time()中的document.write()显示文本.但它没有给出任何结果.
花括号用于"属性值模板",但在这种情况下,您不是在这里创建属性,只是一个普通的文本节点.我想你需要做这样的事情
<xsl:variable name="xx" select="'40967.6424503935'"/>
<script type="text/javascript">
time(<xsl:value-of select="$xx" />);
</script>
Run Code Online (Sandbox Code Playgroud)