A processing instruction with an entity reference as part of an attribute value results in an error.

RESOLVED DUPLICATE of bug 286132

Status

()

Core
XML
RESOLVED DUPLICATE of bug 286132
12 years ago
12 years ago

People

(Reporter: Mark Rogoyski, Unassigned)

Tracking

Trunk
x86
Windows XP
Points:
---

Firefox Tracking Flags

(Not tracked)

Details

(Reporter)

Description

12 years ago
User-Agent:       Mozilla/5.0 (Windows; U; Windows NT 5.1; ja-JP; rv:1.8.0.3) Gecko/20060426 Firefox/1.5.0.3
Build Identifier: Mozilla/5.0 (Windows; U; Windows NT 5.1; ja-JP; rv:1.8.0.3) Gecko/20060426 Firefox/1.5.0.3

In an XML document, if a processing instruction has an entity reference, it results in an error. Instead of parsing the entity, it reads the characters that make up the entity as is.
For example, if you have an XML document that calls the stylesheet called "stylesheet&1234.xsl".
If you have the following processing intruction in the header of your XML document to call an XSL stylesheet: 
<?xml-stylesheet href="stylesheet&amp;1234.xsl" type="text/xsl"?>
it will result in an error and the page will not be rendered or displayed.

Everywhere else in an XML document Firefox will parse the &amp; entity to display as & when using XSLT to transform to HTML. However it does not parse entities when inside the parameter of a processing instruction.

Reproducible: Always

Steps to Reproduce:
1. Try to render an XML document that has a PI that calls an XSLT stylesheet to render it in HTML, and the PI has an entity reference in one of the parameters.
2.
3.

Actual Results:  
Stylesheet error. No page is displayed.

Expected Results:  
The XML file should be rendered into HTML according to the stylesheet.

about:buildconfig

Build platform
target
i586-pc-msvc

Build tools
Compiler 	Version 	Compiler flags
$(CYGWIN_WRAPPER) cl 	12.00.8804 	-TC -nologo -W3 -Gy -Fd$(PDBFILE)
$(CYGWIN_WRAPPER) cl 	12.00.8804 	-TP -nologo -W3 -Gy -Fd$(PDBFILE)

Configure arguments
--enable-application=browser --enable-update-channel=release --enable-optimize --disable-debug --disable-tests --enable-static --disable-shared --enable-official-branding --enable-svg --enable-canvas --enable-update-packaging

Comment 1

12 years ago
As far as I can tell, the &amp; is resolved and the stylesheet is loaded.

Save the following into a file "346359.xul":
<?xml version="1.0"?>
<?xml-stylesheet href="346359&amp;.css" type="text/css"?>
<!DOCTYPE window>
<window xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
<description value="Hello World"/>
</window>

and this into "346359&.css" (note the ampersand) in the same directory:
window { color:lime; font-size:48px; }

Result: the text is green and in a 48px font.
Assignee: nobody → xml
Component: General → XML
Product: Firefox → Core
QA Contact: general → ashshbhatt
Version: unspecified → Trunk

Comment 2

12 years ago
Reading the XML 1.0 spec it seems to me that the current behaviour is wrong:

http://www.w3.org/TR/REC-xml/#syntax
"The ampersand character (&) ... MUST NOT appear in their literal form, except
... within a comment, a processing instruction, or a CDATA section."

See also
http://www.w3.org/TR/REC-xml/#sec-pi
and
http://www.w3.org/TR/REC-xml/#sec-cdata-sect
"Within a CDATA section ... ampersands may occur in their literal form; they need not (and cannot) be escaped using "&lt;" and "&amp;"."

It appears to me that & should be read literally within a PI.

*** This bug has been marked as a duplicate of 286132 ***
Status: UNCONFIRMED → RESOLVED
Last Resolved: 12 years ago
Resolution: --- → DUPLICATE
You need to log in before you can comment on or make changes to this bug.