Re: [xsl] template names

Subject: Re: [xsl] template names
From: Dimitre Novatchev <dnovatchev@xxxxxxxxx>
Date: Mon, 15 Jul 2002 05:09:27 -0700 (PDT)
--- DPawson at rnib dot org dot uk  wrote:

> I have two templates,
>  <xsl:template name="price" mode="export" >
> ...
> and
>  <xsl:template name="price" mode="full">
> Saxon is saying
>   There is another template with the same name and precedence
> Transformation failed: Failed to compile stylesheet. 1 error
> detected.
> Agreed they have the same name, but with different modes.
>  I'm not challenging it as 'wrong', just curious why, when they
> are both moded, a conflict occurs?
> I call them via a choose.
> regards DaveP

Hi Dave,

Using modes is possible only with templates that have the "match"
attribute specified (there is <xsl:apply-templates mode="xxx"/> but
nothing like <xsl:call-template name="xxx" mode="yyy"/>).

It still would be illegal to have identically named templates in the
same stylesheet even in the case they have a "match" and a "mode"
attribute defined -- the XSLT processor doesn't know whether you're
going to instantiate the templates via xsl:apply-templates or via 
<xsl:call-template name="identicalName"/>

In the last case the XSLT processor cannot unambiguously choose which
one of the two identically named templates should be called -- this is
clearly some kind of an error.

Hope this helped.


Dimitre Novatchev. -- the home of FXSL

Do You Yahoo!?
Yahoo! Autos - Get free new car price quotes

 XSL-List info and archive:

Current Thread