我想重新使用XSL模板,并将其他模板放在此模板中多次。重新使用嵌套的XSL模板
这里是我的代码示例:
<xsl:template name="wrapper">
<div>
<xsl:apply-templates/>
</div>
</xsl:template>
<xsl:template name="template1"></xsl:template>
<xsl:template name="template2"></xsl:template>
所以,现在我想申请这两个模板1和模板2内模板“包装”,这样的事(我知道这是不正确的代码,但主意在那里):
<xsl:template name="template1">
<xsl:template match="wrapper">
<!--code here-->
</xsl:template>
</xsl:template>
<xsl:template name="template2">
<xsl:template match="wrapper">
<!--code here-->
</xsl:template>
</xsl:template>
对此的任何帮助将grealty赞赏。
这不是它的工作原理。你想做什么?请提供一些输入XML和根据需要的输出。 – Tomalak 2012-01-27 08:17:33
我可以看到你想要实现的目标,但是,正如@Tomalak所说,除非我们有一些例子来帮助我们理解我们无法真正以任何有用的方式回答 – Murph 2012-01-27 08:20:22
你知道''和你可以“嵌套”这些事实,即,在命名模板中调用call-template,是的? –
2012-01-27 13:27:10