[XSL-LIST Mailing List Archive Home] [By Thread] [By Date]

Re: [xsl] Appending to existing file


Subject: Re: [xsl] Appending to existing file
From: Ronan Klyne <ronan.klyne@xxxxxxxxxxx>
Date: Tue, 17 Jul 2007 16:48:09 +0100

Michael Kay wrote:
>> 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/
> 
> 

Would it not be possible to use the fragment to specify the order, and
have the resolver return a StreamResult which forwarded all data to a
'master' object, and have that object handle writing the file?
If not, I'd be interested to know why...

	# r

-- 
Ronan Klyne
Business Collaborator Developer
Tel: +44 (0)870 163 2555
ronan.klyne@xxxxxxxxxxx
www.groupbc.com


Current Thread