Closed Bug 226413 Opened 21 years ago Closed 21 years ago

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

Categories

(Core :: XSLT, defect)

x86
Windows 2000
defect
Not set
normal

Tracking

()

VERIFIED DUPLICATE of bug 187620

People

(Reporter: ctl, Assigned: peterv)

Details

Attachments

(2 files)

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
Attached file xsl test file
Attachment #136089 - Attachment mime type: text/xml → text/xsl
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.
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
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 :-))
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.
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
Closed: 21 years ago
Resolution: --- → DUPLICATE
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.
Status: RESOLVED → VERIFIED
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: