开发者

set default of selected modes to nothing (no content)>

Ok when we often use this trick:

<xsl:template match="...." mode="m1">my custom output</xsl:template>
<xsl:template match="*" mode="m1"/>

it slowly becomes annoying to always have to do this:

<xsl:template match="*" mode="m1"/>
<xsl:template match="*" mode="m2"/>
<xsl:template match="*" mode="m3"/>
<xsl:template match="*" mode="m4"/>..

And if we do not do it it will give us the "default" template which basically outputs the text content for a text node.. eeks!

Is there a shortcut to the code above?:

Im thinking:

<xsl:template match="*" mode="m1|m2|m3|m4"/>

Well of course it 开发者_开发技巧doesn't work but you get my idea..


Is there a shortcut to the code above?:

Im thinking:

<xsl:template match="*" mode="m1|m2|m3|m4"/> 

Well of course it doesn't work but you get my idea..

Yes. In XSLT 2.0 one can have:

 <xsl:template match="*" mode="m1 m2 m3"/>


With XSLT 2.0 you can use <xsl:template match="*" mode="#all">...</xsl:template>, see http://www.w3.org/TR/xslt20/#modes.


not as far as i know, using the mode suggests its explicit template you wish to call

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜