W3C home > Mailing lists > Public > public-webapi@w3.org > February 2006

Re: [REX] Inserting comments?

From: Robin Berjon <robin.berjon@expway.fr>
Date: Fri, 10 Feb 2006 10:17:59 +0100
Message-Id: <4DF8A7D1-E089-433B-BE23-77B02BB9677B@expway.fr>
Cc: public-webapi@w3.org
To: Stephane Bortzmeyer <bortzmeyer@nic.fr>

On Feb 10, 2006, at 10:01, Stephane Bortzmeyer wrote:
> On Thu, Feb 09, 2006 at 07:01:31PM +0100,
>  Robin Berjon <robin.berjon@expway.fr> wrote
>  a message of 28 lines which said:
>> No, actually, if the target DOM supports comments, then this comment
>> will in fact be inserted into the target document.
> This is not obvious at all.

I'd be happy to clarify the text if you give me an idea of where this  
clarification would have most helped you.

> And I believe that REX patches like:
> <!-- This comment is in the REX source file only -->
> <event target='/some/where' name='DOMNodeInserted'>
>   <!-- This comment will be inserted in the target -->
> </event>
> are quite confusing.

In the way it's interpreted, it's just like:

<event target='/some/where' name='DOMNodeInserted'>

XML comments are nodes like any other nodes. It's probably silly in  
the first place to want to transmit them, but if you do it just  
works. XSLT is a programming language, it has xsl:comment because it  
needs comments of its own. REX is not a programming language, just a  
message format.

>> Is there any part of the specification which makes you believe that
>> it would not
> I agree with Ian Hickson, it seems to me that general XML rules (not
> REX or DOM specific) would prevent it to be inserted.

No, there is no "general XML rule" that prevent comment insertion.

> When I write a
> XSLT template:
> <xsl:template match="foo/bar">
>    <xsl:comment>This one will be added as a comment in the
>    output.</xsl:comment>
>    <!-- This one is a real comment, it will be ignored -->
> </xsl:template>
> The "real" comment (between <!-- and -->) is not inserted.

Right, but XSLT had to specify this behaviour explicitly: "processing  
instructions and comments in the stylesheet are ignored: the  
stylesheet is treated as if neither processing instruction nodes nor  
comment nodes were included in the tree that represents the  
stylesheet". Without this rule it would have been logical to assume  
that nodes in the tree would be included in the output.

Robin Berjon
    Senior Research Scientist
    Expway, http://expway.com/
Received on Friday, 10 February 2006 09:19:08 UTC

This archive was generated by hypermail 2.3.1 : Tuesday, 6 January 2015 21:16:19 UTC