请向我解释如何在XSL模板中包含普通的html
<xsl:choose>
<xsl:when test="position() = last()">
<xsl:text><tr><td colspan='10'>bla bla.</td></tr></xsl:text></xsl:when>
</xsl:choose>
错误:'tr'不能是'xsl:text'元素的子元素。
谢谢!
答案 0 :(得分:3)
只需删除<xsl:text>
代码:
<xsl:choose>
<xsl:when test="position() = last()">
<tr><td colspan="10">bla bla.</td></tr>
</xsl:when>
</xsl:choose>
<xsl:text>
元素表示“在此处插入文字”。因此,其内容必须仅包含文本节点。但是,你可以简单地写出文字;以下两行是等效的:
<xsl:text>foo bar</xsl:text>
foo bar