Re: [xsl] Stylesheet composition

Subject: Re: [xsl] Stylesheet composition
From: Wendell Piez <wapiez@xxxxxxxxxxxxxxxx>
Date: Thu, 15 Nov 2007 14:04:40 -0500
Hi Garvin,

At 01:37 PM 11/15/2007, you wrote:
But the second stylesheet, which is doing the addition, doesn't depend on the nodes that the first one processes, it depends on the nodes that the first one adds. And these nodes (<aaa>) habe the same name as some aleady existing nodes. The question is, is it possible for the xslt processor to find out which <aaa> elemnts are from the source xml and which are added by the stylesheet without adding extra inforomation to the added elements.
Maybe the example is not the best but i wanted to keep it short and simple. I am just looking for a way to influence a template's behavior from outside. In this case I want to control whether stylesheet2 processes all <aaa> nodes or only the ones added by the first stylesheet.

Why is "adding extra information", so your temporary results match different templates in the second pass, such a problem? For example, you could put them a distinct namespace, or add an attribute flag or whatever. It seems to me that this is what your requirement entails in any case -- a subsequent pass that knew the difference between the "old" and "new" elements would presumably have to determine that somehow. So why not make it explicit in the stylesheet, especially since it can generally be done quite cleanly and safely?

I should think this would be preferable to having stylesheets operate differently depending on how engines were invoked. Parameterizing is one thing (and if you were pipelining in a single pass under XSLT 2.0, the behavior you described could indeed be parameterized), but making the semantics of stylesheets depend on externalities such as whether and which other stylesheets are being invoked seems like a recipe for trouble -- to say nothing of how tricky it might be to specify.

Maybe you're onto something different from what I'm thinking, in which case it might help to have your definition of "composition".


Wendell Piez                            mailto:wapiez@xxxxxxxxxxxxxxxx
Mulberry Technologies, Inc.      
17 West Jefferson Street                    Direct Phone: 301/315-9635
Suite 207                                          Phone: 301/315-9631
Rockville, MD  20850                                 Fax: 301/315-8285
  Mulberry Technologies: A Consultancy Specializing in SGML and XML

Current Thread