首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 软件管理 > VSTS >

<xsl:apply-templates> vs <xsl:call-template/>

2013-10-16 
xsl:apply-templatesvsxsl:call-template/Sometimes, though, you want to do something fancier. In

<xsl:apply-templates> vs <xsl:call-template/>

Sometimes, though, you want to do something fancier. In that case, you can create a special template that doesn't match any particular node. For example:

<xsl:template name="print-hello-world">    <xsl:value-of select="concat( bar, ' ' , boo )" /></xsl:template>

And you can then call this template while you're processing <foo> rather than automatically processing foo's child nodes:

<xsl:template match="foo">    <xsl:call-template name="print-hello-world"/></xsl:template>

In this particular artificial example, you now get "Hello World" because you've overriden the default processing to do your own thing.

热点排行