Re: Comments and entities was:

Subject: Re: Comments and entities was:
From: keshlam@xxxxxxxxxx
Date: Wed, 13 Jan 1999 10:20:58 -0500
>The DOM also specifies a slightly odd behaviour of keeping comments
>(which means they are not comments any more).

The DOM is supposed to be able to represent the complete XML syntax, since
it must support both browsing and editing applications. It's left up to the
source (parser or whatever) to decide whether any parts of the document can
be left out, and it's left up to the application to decide whether or not
any given node is meaningful in the particular context.

SAX 1.0 doesn't let applications see comments, but I'd argue that this was
an oversight and that -- like any other event in the stream -- the decision
to listen or not listen to comment events should have been left up to the
application. Again, consider the editor case.



On the pro side: preserving comments from the XSL and source document has
significant potential benefit when trying to debug your stylesheet. I've
worked with rule-driven style systems before, and when the rules get
complex you really do need some way to determine why a particular result
was obtained. Tagging it as it passes through the style rules is a useful
tool.

On the con side: nothing but a human should ever read the content of the
comments; to machines, they're excess baggage. And you may not want to
expose the processing history. You certainly shouldn't allow styling of
comments -- either they get passed through as they stand, or they get
discarded.


I think my own conclusion is that I want to be able to either preserve
comments (for development and debugging purposes, or when XSL is being used
to transcode to another human-maintained format) or discard them (when
XSL's output is going strictly to machines). But I'm undecided whether that
decision should be made by the XSL engine, or by the code that obtains the
document and sends it into the XSL processor.

______________________________________
Joe Kesselman  / IBM Research
Unless stated otherwise, all opinions are solely those of the author.



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


Current Thread