RE: [xsl] Appending to existing file

Subject: RE: [xsl] Appending to existing file
From: "Michael Kay" <mike@xxxxxxxxxxxx>
Date: Tue, 17 Jul 2007 16:31:27 +0100
> Michael, I would find that a tempting approach, however, in 
> your first paragraph, you state that everything can be 
> executed in an undefined order. I assume that means, in 
> theory *and* in practice, that the order in which the 
> OutputURIResolver is called is undefined and hence, the order 
> of the snippets that you are writing to the same target.
> 
> Obviously, by collecting the data before writing it, you can 
> order it by means of some sort of identifier of course.

Actually, the language imposes rules on when you can call
xsl:result-document. In effect, you can only call it at a point where you
would otherwise be writing to a final result tree. You can't call it while
evaluating a variable or function, which are the kind of areas where lazy
evaluation often comes into play. Since writing to the final result tree is
likely to be a fairly sequential process, this means there's a pretty good
chance (especially if you don't "nest" result documents) that the processor
is actually going to handle xsl:result-document instructions in the
"natural" order. So you're running a little bit of a risk by relying on the
order, and I can't judge what risks are acceptable to any particular
project, but in most situations I would be prepared to chance it.

Michael Kay
http://www.saxonica.com/

Current Thread