我想重新使用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