[xsl] Re: Reliance on import precedence considered dangerous

Subject: [xsl] Re: Reliance on import precedence considered dangerous
From: Dimitre Novatchev <dnovatchev@xxxxxxxxx>
Date: Sat, 17 Feb 2001 02:14:25 -0800 (PST)
Hi Jeni,

This is analogous to a case in using an OOPL where you might have:

class B: public D;
class C: public D;

class A: public B, public C;

Then class A will have class D as a base twice.

In C++ there is the notion of "virtual base"

One can write:

class B: public virtual D;
class C: public virtual D;

class A: public B, public C;

In this case class A will have class D as a base only once.


I think that the bad behaviour that results from complying with the import-precedence rules when
importing the same stylesheet (indirectly) twice -- that the solution to this must follow the C++
solution described above.

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:

<xsl:import href="someURI" virtual="yes"/>

will solve the problem.

virtual="yes" will mean: "import this stylesheet only once".
"yes" could be the default value for this attribute.

In case no useful example of importing a stylesheet twice can be found, then the spec must be
updated to say that a stylesheet should not be imported more than once.

It would be interesting to know what do you think about such a solution?

Cheers,
Dimitre Novatchev.



Jeni wrote:
I think I've discovered an odd behaviour concerning imported
stylesheets that I haven't seen mentioned anywhere. I'd be very glad
to be proved wrong (on both it's factual or it's status as a known
problem that David first identified 18 months ago).

When you import the same utility stylesheet (D) into two stylesheets
(B and C) that you then import into a main stylesheet (A), any
templates, attribute sets, global variables or parameters (and so on
for a few other things) in the first stylesheet that's imported (B)
that override the ones in the utility stylesheet (D) will no longer
work as they would if the stylesheet (B) were run standalone.



__________________________________________________
Do You Yahoo!?
Get personalized email addresses from Yahoo! Mail - only $35 
a year!  http://personal.mail.yahoo.com/

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


Current Thread