« 如何打开WebChart的链接? »
Tools » http://www.anysql.net/tools/webchart-new-xsl-template.html 2009-06-04在添加WebChart的超文本链接后, 还是需要XSL的模板来控制打开连接的, 这里就有两种方法, 第一种是用HREF标记来打开链接, XSL文件的模板如下.
<xsl:choose>
<xsl:when test="@href">
<a target="_blank">
<xsl:attribute name="href">
<xsl:value-of select="@href" />
</xsl:attribute>
<xsl:value-of select="." /></a>
</xsl:when>
<xsl:otherwise>
<xsl:value-of select="." />
</xsl:otherwise>
</xsl:choose>
第二种是用onClick事件, 用JavaScript代码来打开链接, 这种方式可以定义更多的新浏览窗口的属性, 使用很广泛. XSL文件的模板如下.
<xsl:choose>
<xsl:when test="@href">
<a href="#myanchor">
<xsl:attribute name="onClick">
javascripts:window.open("<xsl:value-of select="@href" />"); return true;
</xsl:attribute>
<xsl:value-of select="." /></a>
</xsl:when>
<xsl:otherwise>
<xsl:value-of select="." />
</xsl:otherwise>
</xsl:choose>
这是我仅会的一点点XML技术, 怕忘了, 在Blog上做一个笔记.


Recent Comments