问题: 前台页面显示出如下信息:
[err:标签'XXXX装载XSLT模板错误,原因:The variable or parameter 'showforum' is either not defined or it is out of scope.]
此标签内容为:
变量'showforum' 默认为 1 ----------------------标签定义的一个变量
使用的语法为:
<xsl:if test="$showforum = 1">
<div class="red5 marg4">[
<a><xsl:attribute name="href">/xxxxx-<xsl:value-of select="fid"/>.aspx</xsl:attribute>
<xsl:attribute name="target">_blank</xsl:attribute><xsl:value-of select="name"/>
</a>
]</div>
</xsl:if>
分析: 从上面的代码来看,这个标签自已定义了一个变量,然后在标签内容里进行调用,但没有在XSLT模板中预先申明这个变量就进行调用
解决:在变量调用前先进行申明即可,在<xsl:output method="html" />下面加上
即:
<xsl:output method="html" />
<xsl:param name="showforum"/>
.....................................
<xsl:template match="/">