RE: well-formed output XML (was: what are node set fragments ...? )

Subject: RE: well-formed output XML (was: what are node set fragments ...? )
From: Kay Michael <Michael.Kay@xxxxxxx>
Date: Fri, 17 Dec 1999 12:05:16 -0000
> whoops - what I wrote was complete rubbish, because it would 
> require an XSLT processor to (sometimes) keep the entire result tree in 
> memory and only write it out when it's finished processing - which is 
> surely meant to be avoided in XSLT: the idea is that the whole input tree 
> is held in memory[1], but the output tree is written out as a stream as
you go
> along. that means that the stylesheet writer asks for a standalone
> document declaration at their own risk: if the output turns out not to
> be a wf document, it won't be a wf external entity either.

Yes indeed. My current thinking is that if output method="xml" and either a
standalone declaration or a doctype declaration is requested, then I should
report an error if subsequently an attempt is made:
- to output a text node before the first top-level element node
- to output a text node or element node after the first top-level element
node
- to finish processing before a top-level element node has been output.

I think I am justified in doing this because reading section 16.1 as a whole
and ignoring obvious contradictions makes it fairly clear that the intention
of the spec's authors was that the output from method="xml" should be either
a well-formed XML document or a well-formed XML external general parsed
entity or both.

That still leaves me with a little problem if the user asks for output to be
directed to a DocumentHandler and it turns out not to be a well-formed
document. Should I feed the DocumentHandler the events regardless, ignoring
the implicit requirement of the DocumentHandler interface that the events
arive in a well-formed order? Currently for example SAXON is calling FOP's
DocumentHandler, which quite understandably keels over when the first thing
it's given is a text node. 

Mike Kay


 XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list


Current Thread