繁体   English   中英

将XSL参数传递给JS

[英]Passing XSL arguments to JS

我尝试将参数传递给XSL文件中的javascript ...我该怎么做?

    <xsl:variable name="currentPath">
        <xsl:value-of select="concat($path, ./name)"/>/
    </xsl:variable>

<script>
 someFunction(someParameter);
</script>

由于布局原因,我将在这里再次尝试:

<script>  document.getElementById('<xsl:value-of select="$currentPath"></xsl:value-of>').style.display = 'none'; 
</script> 

我正在使用一个变量,它是模板中的一个参数

<xsl:template match="dir">  
<xsl:param name="path"/>

该变量用作表的ID:

<table border="0" id="$currentPath"> 

这个变量正在其他地方使用,并且在那里工作……顺便说一句,我在Firefox 3.5.xx上使用

另一个编辑:我把

<xsl:value-of select="$currentPath"/>

就在脚本标记和预期结果之前...变量不是问题...

在表元素中的引用周围使用花括号:

<table border="0" id="{$currentPath}">

暂无
暂无

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

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM