[xsl] Re: Importing stylesheet

Subject: [xsl] Re: Importing stylesheet
From: Dimitre Novatchev <dnovatchev@xxxxxxxxx>
Date: Tue, 26 Jun 2001 23:52:48 -0700 (PDT)
Adam Van Den Hoven wrote:


> ... I'm wondering if the templates in an included stylesheet
> have access to all the included stylesheets or only the ones it includes in
> itself.
> In a related question, what happens when the same stylesheet is included in
> multiple places in an include chain. I've had it where my final stylesheet
> depends on transforms from two other stylesheets, so it included both. As it
> turns out, the third stylesheet was also dependant on the second. The import
>  tree looked something like
>     +--B
> A--|
>     +--C --B
> (Man that looks crappy on my machine)
> Everything worked fine but MSXML3SP1 seemed to be painfully slow. Eventually
> I realized that C was unnecessary on its own so every was suddenly a lot
> faster but I'm still curious about the effects on performance this should
> have..

Hi Adam,

I think you're actually asking about imported, not included, stylesheets.

The very brief answer is: Be aware that importing more than one stylesheet that
imports and overrides some templates of a fixed (the same) stylesheet -- this is
generally not working correctly.

As Jeni Tennisson and David Carlisle pointed out in ("Reliance on import precedence
considered dangerous" http://sources.redhat.com/ml/xsl-list/2001-02/msg00996.html, 
and http://sources.redhat.com/ml/xsl-list/2001-02/msg01003.html), 
only the overrides in the last imported stylesheet will be used.

The reason for this problem is that in XSLT QName resolution is carried out
statically (by offset from the beginning of the outermost stylesheet).

To overcome this serious limitation, use generic templates:

Generic templates use unique template references, therefore the above problem does
not exist by definition.

Generic templates are the basis for true polymorphism in XSLT.

Hope this helped.

Dimitre Novatchev. 

Do You Yahoo!?
Get personalized email addresses from Yahoo! Mail

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

Current Thread