的问题XSL若没有通过参数通过
从通配符templte比赛经过时,我的参数都上来了空。
我的XML数据源:
<c:control name="table" flags="all-txt-align-top all-txt-unbold">
<div xmlns="http://www.w3.org/1999/xhtml">
<thead>
<tr>
<th></th>
</tr>
</thead>
<tbody>
<tr>
<td> </td>
</tr>
</tbody>
</c:control>
我的XSL:从主模板
初始c:control[@name='table']
比赛是一个更广泛的一块XSL架构做,并分裂出通话
<xsl:template match="c:control[@name='table']">
<xsl:call-template name="table" />
</xsl:template>
然后它会在anot中调用一个命名模板她的文件,它不应该改变我的起始引用 - 我应该仍然能够引用c:control [@ name ='table'],就好像我在匹配模板中一样。
<xsl:template name="table">
<xsl:variable name="all-txt-top">
<xsl:if test="contains(@flags,'all-txt-align-top')">true</xsl:if>
</xsl:variable>
<xsl:variable name="all-txt-unbold" select="contains(@flags,'all-txt-unbold')" />
<div xmlns="http://www.w3.org/1999/xhtml">
<table>
<xsl:apply-templates select="xhtml:*" mode="table">
<xsl:with-param name="all-txt-top" select="$all-txt-top" />
<xsl:with-param name="all-txt-unbold" select="$all-txt-unbold" />
</xsl:apply-templates>
</table>
</div>
</xsl:template>
如果我在上面的模板得到all-txt-top
的价值,它按预期工作。 但是,试图将它传递给下面的模板失败 - 我没有得到任何东西。
<xsl:template match="xhtml:thead|xhtml:tbody" mode="table">
<xsl:param name="all-txt-top" />
<xsl:param name="all-txt-unbold" />
<xsl:element name="{local-name()}">
<xsl:apply-templates select="*" mode="table" />
</xsl:element>
</xsl:template>
即使我尝试传递一个简单的字符串作为参数 - 它不会使它到xhtml:thead模板。
不知道我要去哪里错...任何帮助将不胜感激。
Ahhhh。我认为参数会贯穿到下一个可用的比赛。 给你我的好朋友的荣誉。 非常感谢。 – Kevin