Re: Comments and entities was:

Subject: Re: Comments and entities was:
From: James Clark <jjc@xxxxxxxxxx>
Date: Wed, 13 Jan 1999 11:49:01 +0700
David Carlisle wrote:
> 
> > The XML spec leans heavily in the direction of Entity References being
> > resolved and flattened as the document is read in, which is fine for
> > browsers but may not be acceptable for earlier stages of processing.
> 
> With the (on the face of it) equivalent concept of internal entities in
> SGML one is (I think) forced to do that as there is no `internal entity'
> node in the grove model (as used by dsssl for example). It seems to be a
> great shame that this is not specified in XML.  I would have preferred
> it to be specified that they are always resolved, but leaving it
> unspecified seems to be the worst possible outcome.

Section 5.1 of the XML spec says clearly that all parsers are required
to resolve internal entity references.  (XML does gives flexibility on
external entity references, perhaps a little more than is necessary.)

> The DOM also specifies a slightly odd behaviour of keeping comments
> (which means they are not comments any more). Could  you confirm what
> happens in a DOM based XSL system if I go
> 
>  <xsl:template match="apply">
>    <!-- hello world: this is a comment in my stylesheet -->
>  <xsl:apply-templates
>      .....
> 
> Does the comment node find its way into the template and then into the
> output document?

If it does, then it's a bug in that XSL implementation. XSL specifies
that such a comment would not find its way into the output document. (In
2.4, "Neither processing instruction nodes nor comment nodes are
included in the tree for the stylesheet".) If you are implementing XSL
on top of the DOM, then you need to ignore comment nodes and PI nodes in
the stylesheet.

James



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


Current Thread