Re: multiple templates with same name

Subject: Re: multiple templates with same name
From: James Clark <jjc@xxxxxxxxxx>
Date: Wed, 11 Aug 1999 12:28:58 +0700

Jon Smirl wrote:
> 
> I have defined several template with the same name.  Sometime like:
>  <xsl:template name="main">
>  </xsl:template>
> 
> I have two include files, each defining a main template. My top level file
> also defines the main template. With XT the one in the main file wins. With
> Saxon the first one encountered wins.  This isn't a bug,  the two include
> files are also used standalone and need a main template defined.
> 
> What is the correct order for resolving the multiple definitions?

The WD says (http://www.w3.org/TR/WD-xslt#named-templates): "It is an
error if a stylesheet contains more than one template with the same name
and same import precedence. An XSLT processor may signal the error; if
it does not signal the error, it must recover by choosing from amongst
the templates with highest import precedence the one that occurs last in
the stylesheet."

You would be unwise to rely on this error recovery behaviour.

James



 XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list


Current Thread