Closed Bug 221862 Opened 21 years ago Closed 21 years ago

Content of <xsl:comment> tags are completly ignored when parsing XML. HTML output ist fine.

Categories

(Core :: XSLT, defect)

x86
Windows NT
defect
Not set
normal

Tracking

()

RESOLVED INVALID

People

(Reporter: hannes, Assigned: peterv)

References

Details

Attachments

(4 files)

User-Agent:       Mozilla/5.0 (Windows; U; WinNT4.0; en-US; rv:1.4) Gecko/20030624
Build Identifier: Mozilla/5.0 (Windows; U; WinNT4.0; en-US; rv:1.4) Gecko/20030624

If you use <xsl:comment> within a <style type="text/css"> tag in your XSLT, the
CSS commands are ignored and not aplied to the page. Same with Java Script.
The rendered HTML looks perfect, <style type="text/css"><!-- ... . If page is
saved to HTML and reopened, everything works fine.

Reproducible: Always

Steps to Reproduce:
1. Download the attatched simple XML file and save it /some/where/test.xml:
2. Download the attatched simple XSL file and save it /some/where/test.xsl:
3. Drop XML into Mozilla
4. File/SavePageAs /some/where/test.html
5. Open test.html

Actual Results:  
The .XML File does not show pink text, the .HTML file does.

Expected Results:  
Both should show pink text
Confirmed on Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.5) Gecko/20030925
Funny. Folks confirm, but don't confirm, and yet don't know what's happening.

This is a significant difference between serializing and non-serializing XSLT
processors.
http://www.w3.org/TR/1999/REC-html401-19991224/interact/scripts.html#h-18.3.2
states that the "comment" tags inside html script elements are not comments.
That is due to the fact, that script tags are CDATA elements,
http://www.w3.org/TR/1999/REC-html401-19991224/sgml/dtd.html#Script
that is, they don't contain markup. As such, there is no comment beneath the
script or the style element and the string '<!--' is fed to the js engine
and ignored over there.
In a scheme where the XSLT processor does not serialize, we actually do generate
a comment beneath the script element, which is ignored.

The XSLT spec doesn't give any argument to handle it differently, so we stick
to this scheme of dynamic content generation. More so, as the pseudo-comment 
is to deal with user agents not capable of style or script, unlikely to happen
with a user agent aware of XSLT.

Note to self, add this to the FAQ.
Status: UNCONFIRMED → RESOLVED
Closed: 21 years ago
Resolution: --- → INVALID
Attached image Screenshot of IE
Screenshot how IE interprets XSL as expected
Attached image Screenshot of MOZILLA
Screenshot how MOZILLA interprets XSL without respecting the information given
in the Style Tag.
> In a scheme where the XSLT processor does not serialize, we actually do
> generate a comment beneath the script element, which is ignored.

Yes, correct, as described in
http://www.w3.org/TR/1999/REC-html401-19991224/present/styles.html#hiding this
is the way to hide the content of STYLE elements from non-conforming user agents.

But what is happening here is, that it is eaven hid from conforming Mozilla. The
Information of the <STYLE> tag is not applied to the Document.

JS is all the same.
Status: RESOLVED → UNCONFIRMED
Resolution: INVALID → ---
you want
<script>&lt;--
 // do stuff
 // --&gt;
<script>
Status: UNCONFIRMED → RESOLVED
Closed: 21 years ago21 years ago
Resolution: --- → INVALID
*** Bug 222775 has been marked as a duplicate of this bug. ***
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: