RE: [xsl] Priority and import precedence

Subject: RE: [xsl] Priority and import precedence
From: "Andrew Welch" <ajwelch@xxxxxxxxxxxxxxx>
Date: Tue, 1 Feb 2005 10:21:45 -0000
> > Would it be possible to add a warning message to Saxon,
> like ambiguous
> > rule match, when one template is chosen over another purely
> by import
> > precedence
> wouldn't that make import virtually unusable?
> Usually when I use import _every_ template in the importing
> stylesheet is overriding a template in the imported one
> (often because the latter has a template matching *).  I
> thought your earlier suggestion was that certain special
> templates could have an attribute to flag they should be top
> of the import tree and generate a warning if not.

Yes it was :) But if we can't have that then at least we should know
when it has happened (just like ambiguous rule match) rather than
silently getting the wrong output.  (Wrong as in 'not intended').

When I talk about 'one template being chosen over another just because
of import precedence' I am talking about the order of the imports - the
following import winning over the preceding import - *not* stylesheet A
importing stylesheet B.

So, in your example above, you would only get the warning message if you
imported two stylesheets that each had a template with the same match
pattern, that weren't overridden in your importing stylesheet, and one
of those templates was chosen over the other because it was in a
stylesheet that was imported later than the other one.

It may not be feasible, but I had a bug recently because of this and
thought it was a bit poor that the fix involved either re-ordering the
imports or moving the template into the importing stylesheet.  At least
if we have a warning, we could re-order the imports with confidence and
keep templates in the stylesheets they logically belong in.


Current Thread