xsl-list
[Top] [All Lists]

RE: Priority and import precedence

2005-01-31 10:06:48

It just seems really strange that the ordering of the import 
statements should be more important that the priority attribute.

I think that the reason for xsl:import's existence is that 
you should be able to take 10000000000 lines of Norm's 
docbook stylesheets, xsl:import them and then define a couple 
of your own templates for specific elements where you want 
your own processing. You can be sure that your templates will 
win, even if you have not fully digested the publicly 
available stylesheets that you were importing.

If you had to know the priorities on the templates that you 
wanted to override, you'd have to understand the stylesheets 
well enough to work out which templates were being used, and 
with what priority, and then specify a higher one. (well 
actually it would be easier just to keep adding 0's to the 
end of the priority until you won:-)

The scenario is slightly different here - if I'm importing norm's
docbook stylesheets then any templates I write will override his.
However, if I import norm's stylesheets and some of my own, my own
imported templates could be overidden by norms if I import his
stylesheets after my own.  

Now, this makes perfect sense because as the importer I have control
over the order of imports and so I can swap them around and everyone's
happy.  But it's made me think what if you don't have control of the
'importer' stylesheet?  On larger projets you could get some really
subtle bugs that go unnoticed because of import precedence.  What do you
think about being able to make a template final (to use java
terminology) such that it would be a compiler error if another
stylesheet contained a conflicting template with a higher priority?  It
other words: "if you use my stylesheet, you have to use this template as
I designed it".

cheers
andrew

--~------------------------------------------------------------------
XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: <mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--



<Prev in Thread] Current Thread [Next in Thread>