Re: [xsl] Re: Reliance on import precedence considered dangerous

Subject: Re: [xsl] Re: Reliance on import precedence considered dangerous
From: Jeni Tennison <mail@xxxxxxxxxxxxxxxx>
Date: Sat, 17 Feb 2001 11:44:59 +0000
Dimitre Novatchev wrote:
> In case if someone could point examples (which I strongly doubt)
> when importing the same stylesheet twice is useful -- then having a
> "virtual" attribute of xsl:import as below:

David said that he had a real-life example of this problem.

Having thought about it some more, the real issue is if both B & C
(which both import D and are both imported by A) override something in
D in different ways.  I don't think(?) that a virtual attribute would
address this problem?

Because the import *tree* is turned into a flat list of import
precedences, you can't rely on stand-alone stylesheets that are
imported into a stylesheet to behave in the same way as they did when
they stood alone (regardless of whether the importing stylesheet
itself overrides anything in them or not).  Even if you just have A
importing B and C, C might still have something in it that overrides
something in B.

That just wasn't what I'd have expected. I can see how it might make
things a whole lot easier for implementers, but it makes creating
modular XSLT applications ultimately unpredictable :(

[A positive suggestion that won't even be considered until XSLT 3.0
would be that when templates are applied or called, the only templates
that are considered are those (a) with the stylesheet holding the
apply/call instruction (b) the stylesheets that it imports and (c) any
stylesheet that imports it, recursively up the import tree.  So with:

      B +
     /   \
  A +     E
      C -- D

then if a xsl:apply-templates or xsl:call-template in B was processed,
then the templates that were examined would be those in A, B, E, D (in
descending order of precedence) rather than as it is at the moment: A,
C, D, B, E, D.

Processors must have some inkling about the import *tree* rather than
*list* and some ability to focus the templates that are examined to
support xsl:apply-imports, so this shouldn't be *too* big a thing.
Should it?]


Jeni Tennison

 XSL-List info and archive:

Current Thread