This is the mail archive of the xsl-list@mulberrytech.com mailing list .


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Re: call-template does not find named template in same stylesheet


Hi.

> I have 2 stylesheets, 1st stylesheet does a bunch of imports.  2nd
> stylesheet calls named templates (the named templates are defined in the
> imported stylesheets.
>
> In the 2nd stylesheet, I have defined a named template.  There is a
> template by the same name in one of the stylesheets imported in 1st
stylesheet.
>
> My problem is that when I call the template in the second stylesheet, I
> expect it to resolve to the local named template, but it does not.  The
> template "test" in the imported stylesheet is being called.

[skip]

> Thanks....been beating my head on this one.

The problem is that when there are several templates with the same name (or
match) only the one with highest import precedence is considered. So if you
have
template "name" in stylesheet 1
template "name" in stylesheet 2
and stylesheet 1 imports stylesheet 2
the <xsl:call-template name="name"/> will only call the "name" template in
stylesheet 1 because it has a higher import precedence.

I do not think there is a way to call only the templates which present in
the _same_ stylesheet (and still allow them to be called from the outside).
But I think maybe xsl:apply-imports will do the job?
You will have to change from named templates to modes maybe.

I also suppose that you do not actually need this - could you clarify the
problem you need to solve?

Bye.
/lexi


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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]