一直在尝试这一堆不同的方式。下面(不起作用)基本上是我想要做的。使用变量“defineClick”定义“onclick”代码,并动态地将其插入div/onclick处理程序。其他定义的$ block变量在文件中。感谢XSLT,需要将javascript插入onclick处理程序
<xsl:choose>
<xsl:when test="txtBlockTarget='_blank'">
<xsl:variable name="defineClick">window.open('{$block}','_blank');</xsl:variable>
</xsl:when>
<xsl:otherwise>
<xsl:variable name="defineClick">location.href='{$block}';</xsl:variable>
</xsl:otherwise>
</xsl:choose>
<div onclick="{$defineClick}" style="cursor: pointer;">
.....more xsl.....
</div>
什么“不起作用”呢? –