2011-06-27 75 views
2

我嘗試在XSL文件中將參數傳遞給javascript ...我該怎麼做?將XSL參數傳遞給JS

<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"/> 

變量作爲表格的編號:

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

這個變量是在使用別的地方,它是由我在Firefox 3.5.xx

另一個編輯方式在那裏工作...: 我把

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

script標籤前面,並結果預計...變量是沒有問題的......

+0

您從哪裏傳?您首先需要''then'someFunction('')' – mplungjan

+0

的JavaScript在(你不應該) – mplungjan

+0

當然沒有... thx爲你的努力順便說一句! – peter

回答

0

周圍使用的表格元素的引用花括號:

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