Subject: Re: what are node set fragments and why are they ruining my life? From: Phil Lanch <phil@xxxxxxxxxxxxxxx> Date: Wed, 15 Dec 1999 15:33:26 +0000 |
Kay Michael wrote: > > Bizarre perhaps, but not a bug. sxf:node-set is documented to work this way. > As well as putting the dummy root node in as a parent for the user-written > nodes, it also wraps a dummy element around them, to make the fragment a > well-formed document. This was basically done for code reuse reasons, and > because at the time it was written the implementation of result tree > fragments was not exposed to the application. > > This will change in the next version to work the same as xt. ah - sorry I suggested it's a bug. (no I didn't read the documentation.) > 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 XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
RE: what are node set fragments and, Kay Michael | Thread | Re: what are node set fragments and, Phil Lanch |
Mixing XSL stylesheet and Java hand, Yannick Nicolas | Date | XSL sheet to output to a plain text, Dylan Walsh |
Month |