xsl stylesheet missing <?xml ..> directive yields blank page

VERIFIED DUPLICATE of bug 187620

Status

()

VERIFIED DUPLICATE of bug 187620
15 years ago
15 years ago

People

(Reporter: ctl, Assigned: peterv)

Tracking

Trunk
x86
Windows 2000
Points:
---

Firefox Tracking Flags

(Not tracked)

Details

Attachments

(2 attachments)

(Reporter)

Description

15 years ago
User-Agent:       Mozilla/5.0 (Windows; U; Windows NT 5.0; en-US; rv:1.5) Gecko/20031007
Build Identifier: Mozilla/5.0 (Windows; U; Windows NT 5.0; en-US; rv:1.5) Gecko/20031007

When using a XSL stylesheet that does not start with
<?xml version="1.0" encoding="iso-8859-1" ?>
(or similar), 
Mozilla shows a blank page, although both the XML and XSL
files are OK. Adding <?xml ..> to the start of the stylesheet
fixes the problem.

Unfortunately, I could not construct a simple example to show this
behavior, and the used XML and XSL files are currently proprietary. 
I will try to generate a test case ASAP.  




Reproducible: Always

Steps to Reproduce:
1. 
2.
3.
This has absolutely nothing to do with CSS.
Assignee: dbaron → peterv
Component: Style System (CSS) → XSLT
QA Contact: ian → keith
Make sure your server is sending the correct mime-type. If you're not sending a
mimetype mozilla will try to guess the mimetype which it probably fails to do if
the <?xml ... stuff is missing. However if you send "text/xml" as mimetype
mozilla won't do any guessing and things should work just peachy

Comment 3

15 years ago
Created attachment 136089 [details]
xsl test file

Updated

15 years ago
Attachment #136089 - Attachment mime type: text/xml → text/xsl

Comment 4

15 years ago
Created attachment 136090 [details]
xml test file (without xml prolog)

Comment 5

15 years ago
It is probably my mistake, but what is wrong with this:

<?xml-stylesheet
href="http://bugzilla.mozilla.org/attachment.cgi?id=136089&amp;action=view"
type="text/xsl"?>
<test>
 <t-element>FAIL</t-element>
</test>

BTW: If I test this offline, nothing works. Also with an xml prolog, nothing works.
(Assignee)

Comment 6

15 years ago
Comment on attachment 136089 [details]
xsl test file

text/xsl is not a valid mimetype (though we support it in the type attribute of
the xml-stylesheet PI for compatibility reasons). The local file problem is
probably because .xsl files aren't set to text/xml in your OS's filemapping
settings and Mozilla fails to detect them as XML because of the missing XML
declaration.
Attachment #136089 - Attachment mime type: text/xsl → text/xml

Comment 7

15 years ago
You are probably right. I thought about this too. I made a test case on my web
account and addes some rules to the .htaccess file to make sure they get the
correct mime types:

http://www.annevankesteren.nl/test/xml/bugzilla/ (i'm not sure if that dir is
going to be there forever :-))

Comment 8

15 years ago
re #7, the xsl is sent with text/xsl, which is, as Peter just pointed out,
not a valid mimetype. Huh?
Make that text/xml.
Oh, loading the stylesheet off from bugzilla from a local file or a different 
server won't work for security reasons. See the faq.

Comment 9

15 years ago
I don't get it...
- <http://annevankesteren.nl/test/xml/bugzilla/xml-001.xml>
- <http://annevankesteren.nl/xml/rss/2.0/>

(sorry for the late reply)
http://annevankesteren.nl/test/xml/bugzilla/xml-001.xml
doesn't work because of bug 187620. You are creating a result-document that only
contains text. The xslt-engine has a bug that causes us to be unable to display
the page. It's easy to fix thogh, just wrap the result in some sort of element
and it'll work great. You probably want to generate html anyway which means that
you should create a <html> rootelement.

http://annevankesteren.nl/xml/rss/2.0/
Doesn't work because the mimetype of the stylesheet
(http://annevankesteren.nl/mt/style/rss.xsl) is "text/xsl" which is not a valid
mimetype. It should be "text/xml" or "application/xml". You can still keep
type="text/xsl" in the <?xml-stylesheet ...?> processing-instruction to link to
the stylesheet. The reason we support that that is the only thing that works in
IE and we want it to be possible to create pages that work in both mozilla and IE.

*** This bug has been marked as a duplicate of 187620 ***
Status: UNCONFIRMED → RESOLVED
Last Resolved: 15 years ago
Resolution: --- → DUPLICATE

Comment 11

15 years ago
Euh, <http://annevankesteren.nl/xml/rss/2.0/> DOES work:
 - Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.6b) Gecko/20031214

And I am probably missing some knowlodge of XSLT, 'cause I though I was only
replacing the contents of what I selected with XSLT => wrong! :-)
Yes, that is wrong. You are building a compleat new page. Buf if you add a
template like:

<xsl:template match="node() | @*" priority="-1">
  <xsl:copy>
    <xsl:apply-templates select="node() | @*"/>
  </xsl:copy>
</xsl:template>

Then the effect is pretty much the same. This template will make a straight copy
of the document and only parts selected by other templates will be different.

Updated

15 years ago
Status: RESOLVED → VERIFIED
You need to log in before you can comment on or make changes to this bug.