Re: xsl:comment problem

Jonas Sicking <[email protected]> Fri, 09 Mar 2007 14:40:30 -0800
Newsgroups gmane.comp.mozilla.devel.layout.xslt
Message-ID <[email protected]>
Thomas Comiotto wrote:
>> First of all, why are you doing this? The
>>
>> <style>
>> <!--
>> ...
>> -->
>> </style>
> 
> I'm writing an firefox editor extension that renders an xhtml view by 
> (re)using xml2xhtml stylesheets provided by a content server (e.g. 
> cocoon). As it turns out my app has to deal with this case because it's 
> what people do at the server side and they want to reuse their stuff.

In this case you probably can't reuse their stylesheet directly. Or you 
can encourage them to remove that hack from their stylesheet since I 
doubt they really support browsers that don't support stylesheets anyway.

>> construct was invented to make browsers that didn't support 
>> stylesheets not display the stylesheet as text. However to my 
>> knowledge there are no browsers that support XSLT but does not support 
>> stylesheets.
>>
> 
> See above.
> 
> 
>> Second, comments in the DOM are always ignored. Even inside 
>> stylesheets and scripts. The reason that the above construct works in 
>> HTML is that the contents of the <style> tag is not actually markup, 
>> but rather always treated as text. If you look at the DOM you'll see 
>> that there is not a comment, but rather a textnode, inside the style 
>> element.
>>
>> If you try the above in XHTML you'll find that the comment is ignored. 
>> Same thing if you insert a comment in a HTML document using the DOM.
> 
> I don't get you point.

My point was simply that we're doing the right thing by ignoring comment 
nodes in the DOM. Note that we're not ignoring the <xsl:comment> 
instruction, it will create a comment just as requested. However we then 
ignore that created comment since we simply treat it as, well, a comment.

However, after rereading your original post, i have to admit i'm not 
quite following what you're saying. Please attach a *small* testcase and 
describe what you think behaves wrong with it.

Best Regards,
Jonas Sicking