Re: what are node set fragments and why are they ruining my life?

Subject: Re: what are node set fragments and why are they ruining my life?
From: Phil Lanch <phil@xxxxxxxxxxxxxxx>
Date: Thu, 16 Dec 1999 10:36:07 +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.

not satisfactory.

Me wrote:
> 
> Kay Michael wrote:
> >
> > I'm hitting a few other problems in the area of output XML not needing to be
> > a well-formed document, e.g. when calling a DocumentHandler to process the
> > output, or when chaining it into another stylesheet. (The contract with a
> > SAX DocumentHandler of course says that the sequence of events will always
> > be well-formed). It's an area where the spec seems a bit vague, e.g. it
> > seems perfectly possible to output
> >
> > <?xml version="1.0" encoding="UTF-8" standalone="yes"?>
> > <element1/>
> > <element2/>
> >
> > which is neither a well-formed document nor a well-formed external entity.
> 
> an external parsed entity (http://www.w3.org/TR/REC-xml#NT-extParsedEnt)
> may begin with a text declaration, which is like an xml declaration
> except that it can't include a standalone document declaration. so your
> example would be a well-formed external entity if you left the
> standalone document declaration out. I think the spec -
> 
> "The xml output method should output an XML declaration unless the
> omit-xml-declaration attribute has the value yes. The XML declaration
> should include both version information and an encoding declaration. If
> the standalone attribute is specified, it should include a standalone
> document declaration with the same value as the value as the value of
> the standalone attribute. Otherwise, it should not include a standalone
> document declaration; this ensures that it is both a XML declaration
> (allowed at the beginning of a document entity) and a text declaration
> (allowed at the beginning of an external general parsed entity)." [16.1]
> 
> - is _trying_ to say that you should leave it out when the output can't
> be a document - though it's _actually_ saying you should leave it out
> when the xsl:output element has no standalone attribute. Since that
> contradicts the spec's own statement that the output should be either a
> well-formed document or a well-formed external entity, presumably you're
> entitled to pick the more sensible of the contradictory statements.

-- 

cheers

phil

"that monotonous state of the soul halfway between fulfillment
and futility which comes with life in the country" --- Musil

[1] unless that is optimized away for simple stylesheets, or replaced
with a multi-pass streaming strategy


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


Current Thread