Closed Bug 441825 Opened 18 years ago Closed 18 years ago

XML won't load the style sheet if processing instruction contains an unencoded ampersand in FF3

Categories

(Core :: XML, defect)

x86
Windows XP
defect
Not set
normal

Tracking

()

RESOLVED INVALID

People

(Reporter: karl.arp, Unassigned)

References

Details

(Keywords: regression, testcase)

Attachments

(1 file)

User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.9) Gecko/2008052906 Firefox/3.0 Build Identifier: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.9) Gecko/2008052906 Firefox/3.0 I'm using CGI and PHP to deliver XSL stylesheets. When they contain an &, the following happens. In Firefox 2, the XSL stylesheet loads just fine and the document is translated appropriately. In Firefox 3, the stylesheet isn't requested, so it doesn't load, and Firefox displays the page as if each tag were just HTML. In FF3, if you url encode the ampersand, it will request the stylesheet and all goes according to plan. However, according to w3c: "The ampersand character (&) and the left angle bracket (<) MUST NOT appear in their literal form, except when used as markup delimiters, or within a comment, a processing instruction, or a CDATA section. If they are needed elsewhere, they MUST be escaped using either numeric character references or the strings "&amp;" and "&lt;" respectively." (http://www.w3.org/TR/REC-xml/#syntax) My understanding of that is that FF2 handles this correctly, while FF3 does not. Reproducible: Always Steps to Reproduce: 1.Open XML page with a link to a stylesheet which has an ampersand in the url. 2. 3. Actual Results: Firefox 3 displays the content of the XML tags as if they were HTML tags. Expected Results: Firefox 3 would translate the XML document using the XSL stylesheet and display the results. I have several extensions installed, though I doubt they're the cause of the issue. Firebug 1.2.0b3 * Adblock Plus 0.7.5.5 * ColorZilla 2.0 DOM Inspector 2.0.0 Gmail Manager 0.5.5 IE Tab 1.5.20080310 * IE View 1.3.7 NoScript 1.6.9.3 Tamper Data 10.0.4 Web Developer 1.1.6 YSlow 0.9.5b2 This issue has been reproduced on another computer which only has the starred (*) extensions installed.
Do you have a testcase somwhere were we can see the bug? Or perhaps, could you attach a testcase?
Component: File Handling → Error Console
Product: Firefox → Core
QA Contact: file.handling → error-console
Version: unspecified → Trunk
Component: Error Console → XML
QA Contact: error-console → xml
Keywords: regression
If this renders correctly, it will say: Here is the first element T1 Here is the second element T2 If it fails to render correctly, it will say: T1 T2 I obviously get the latter.
I just thought I'd point out that, if you'd like to see the results as they should be displayed, you can just remove the arguments from the stylesheet link in the XML. i.e. "q.xsl?test=1&c=6" becomes "q.xsl" It displays properly in both version of FF that way.
Keywords: testcase
This seems to work according to spec. As pointed out in comment 0 even (or am I misunderstanding the comment?) According to spec the '&' character in any pseduo-attribute in the xml-stylesheet processing instruction should be interpreted as the start of an entity. So: <?xml-stylesheet href="foo.xml?a=b&c=d"?> is invalid as 'c=d' isn't a valid entity, and it's also not terminated with a ';'. <?xml-stylesheet href="foo.xml?a=b&amp;c=d"?> is however valid and makes us fetch the url <foo.xml?a=b&c=d> Similarly <?xml-stylesheet href="foo.xml?a=b%26c=d"?> is valid, but makes us fetch the url <foo.xml?a=b%26c=d> which is probably not what you want, since the server will decode that as a single query parameter "a" with the value "b&c=d". Hope that makes sense. Spec is available here: http://www.w3.org/TR/xml-stylesheet/#NT-PseudoAtt
Status: NEW → RESOLVED
Closed: 18 years ago
Resolution: --- → INVALID
Might be a good idea to add this testcase and variants to the regression suite, by the way, so someone doesn't come along and "fix" this.
Flags: in-testsuite?
I just wanted to post this info in case anyone else was having the same problem understanding this as I did. In comment 0, I noted that the ampersand character must not appear in its literal form except when used as a processing instruction. This is why I thought it was something that needed to be fixed. After investigating some more to better understand why I was wrong, I found this link: http://www.w3.org/TR/xml-stylesheet/#The%20xml-stylesheet%20processing%20instruction It explains how the stylesheet processing instruction should be laid out, which, to me, seems to contradict the original statement. Either way, the second instance is specifically tailored to stylesheet PIs, and explains it fairly clearly.
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: