Re: AW: [xslt] Extension module initialization is called for everyimported stylesheet



Hello Kasimier,

On Wed, 3 May 2006 13:28:57 +0200
"Buchcik, Kasimier" <k buchcik 4commerce de> wrote:

...
> > > 
> > > As far as I remember, more precise behaviour is the following.
> > > Initialization is expected for every (imported or main) 
> > stylesheet which
> > > has the corresponding "extension-element-prefixes".
> 
> What is the reason of this expectation?

I used incorrect wording. It's actually not expectation, but an
observation. The correct description is given by you in the thread
"Processing of extension-elements/functions and user-defined data
elements".

> 
> > > > 
> > > >   It's probably an oversight, once per stylesheet should 
> > be sufficient.
> > > 
> > > Do you mean "once per the whole stylesheet"? I think it is 
> > not sufficient.
> > > 
> > > I have a chain of imported xslt-files that looks like:
> > > 
> > > -- [code]
> > > <x:stylesheet extension-element-prefixes="myx" ...>
> > > 
> > > <myx:init>...</myx:init>
> 
> <myx:init> is not an extension element, so actually there
> should be no need to use "extension-element-prefixes" here.

I agree. I didn't think about it.

> 
> > > ...
> > > 
> > > </x:stylesheet>
> > > --- [/code]
> > > 
> > > When my xsltStyleExtInitFunction is activated, it looks for 
> > "myx:init" and
> > > performs additional initialization for the corresponding 
> > xslt file. If the
> > > function were called only once, I'd have problems to locate 
> > all "myx:init"
> > > in all xslt files.
> 
> I am in doubt about the correctness of this approach; or, if
> we want to avoid the word "correct": I think this is more a hack
> than a solution following the semantics of XSLT.
> You are using the "extension-element-prefixes" mechanism
> (which, I think, should not fire an initialization at all), to
> process the user-defined data element <myx:init>.
> "User-defined data" elements (this is a term which was introduced
> in XSLT 2.0) and the definition of namespaces of extension elements
> are not related.

In addition to user-defined data, there is a possible need to pre-compile
extension elements. While refactoring, please retain this possibility.

> 
> With xsltRegisterExtModuleTopLevel() you can register such
> top-level user-defined data elements to be processed.

I hope it's a good idea. Would you please give more details? What is the
order of execution of the top-level data elements? Can I implement
the "destructor" of a stylesheet -- something that is executed after
applying templates?


> 
> Kasimier
> 


-- 
Oleg Parashchenko  olpa@ http://xmlhack.ru/  XML news in Russian
http://uucode.com/blog/  Generative Programming, XML, TeX, Scheme
XSieve at XTech 2006: http://xtech06.usefulinc.com/schedule/detail/44



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]