Re: importance

Subject: Re: importance
From: James Clark <jjc@xxxxxxxxxx>
Date: Wed, 02 Jun 1999 13:31:13 +0700
Jakob Fix wrote:
> 
> given a stylesheet "a" which imports two stylesheets "b" and "c" which in
> turn import one stylesheet each, "d" and "e" what is their relationship
> importance-wise?
> 
>    a
>   / \
>   b  c
>   |  |
>   d  e
> 
> following the spec, "a" as the importing stylesheet is the most important
> one. (section 15.1 Stylesheet Import).
> 
> now, is the order of importing the stylesheets
>     "b" then "c" then "d" then "e", or
>     "b" then "d" then "c" then "e"?
> This seems not to be explicitly stated in the spec, but is obviously
> necessary to decide on the imortance of each.
> 
> When the spec says
> 
> "Definitions and template rules in the importing stylesheet are defined to
> be more important than definitions and templates in any imported
> stylesheets."
> 
> does "importing stylesheet" mean the root stylesheet, "a" only, or any
> stylesheet that imports another stylesheet?

It means that if stylesheet X imports stylesheet Y then X is more
important Y. So if we use X > Y to mean that X is more important than Y,
we have

a > b
a > c
b > d
c > e

The spec also says:

  Also definitions and template rules in one
  imported stylesheet are defined to be more important than
  definitions and template rules in previous imported
  stylesheets.

This is intended to mean in your case that:

c > b
c > d
e > b
e > d

(Clearly there's scope for improving the wording here.) Implicit in the
spec is the idea that importance is transitive: if X > Y and Y > Z then
X > Z.

So putting this together the order of importance of the stylesheets in
your example would be (most important first):

a c e b d

Remember that all xsl:import statements must come at the beginning of
the stylesheet before any template rules.  So if you parse an xsl:import
when you see it, then the template rules will be encoutered coming from
stylesheets in the following order:

d b e c a

ie precisely in reverse order of importance.

James



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


Current Thread
  • importance
    • Jakob Fix - Tue, 1 Jun 1999 19:37:00 +0200
      • James Clark - Wed, 02 Jun 1999 13:31:13 +0700 <=