xsl-list
[Top] [All Lists]

Re: [xsl] Appending to existing file

2007-07-17 08:49:28
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/


--~------------------------------------------------------------------
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>
--~--



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(_dot_)klyne(_at_)groupbc(_dot_)com
www.groupbc.com

--~------------------------------------------------------------------
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>
--~--