Subject: Re: XSLT Draft: Modes vs. Variables From: James Clark <jjc@xxxxxxxxxx> Date: Wed, 28 Apr 1999 07:47:07 +0700 |
Oren Ben-Kiki wrote: > >... there seems to be very little > >difference between a template declared as > > > ><xsl:template match="node()" mode="bo-peep" priority="[infinity]"> > > > >and one declared as > > > ><xsl:template name="bo-beep">. > > There's one crucial difference: calling: > > <xsl:apply-templates mode="bo-beep" select="..."/> > > Has no equivalent using named templates. Note that the following: > > <xsl:for-each select="..."> > <xsl:call-template name="bo-beep"/> > </xsl:for-each> > > Is _not_ the same thing, since there must be only one template name > 'bo-beep' in the 'for-each' case. Huh? It would be an error if there was more than one template rule declared as: <xsl:template match="node()" mode="bo-peep" priority="[infinity]">...</xsl:template> and, given such a template rule, <xsl:apply-templates mode="bo-peep" select="..."/> would always apply the same template. If xsl:call-template had a select attribute, then it would be exactly equivalent to what in the current WD is: <xsl:for-each select="..."> <xsl:call-template name="bo-beep"/> </xsl:for-each> The WG considered lots of different alternatives (including not having <xsl:call-template> and <xsl:template name="..."> at all, having a select attribute on xsl:call-template, combining xsl:apply-templates and xsl:call-template) before settling on the current design. The model behind the current design is that there are two ways to invoke templates, by name and by pattern matching. To invoke templates by name use xsl:call-template. To invoke templates by pattern matching use xsl:apply-templates. The match and mode attributes on xsl:template control when the template can be invoked by pattern matching. The name attribute on xsl:template controls when the template can be invoked by name. James XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
Re: XSLT Draft: Modes vs. Variables, Oren Ben-Kiki | Thread | Fw: XSLT Draft: Modes vs. Variables, Oren Ben-Kiki |
XSL is difficult to...?, Don Park | Date | RE: XSL and Web Native distributed , Jonathan Borden |
Month |