Closed Bug 561083 Opened 14 years ago Closed 14 years ago

Using the xml-stylesheet loader breaks the Document object for javascript.

Categories

(Core :: XSLT, defect)

x86_64
Linux
defect
Not set
normal

Tracking

()

RESOLVED DUPLICATE of bug 230214

People

(Reporter: dhimes, Unassigned)

Details

Attachments

(3 files)

User-Agent:       Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9.3a5pre) Gecko/20100422 Minefield/3.7a5pre
Build Identifier: Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9.3a5pre) Gecko/20100422 Minefield/3.7a5pre

Using a XHTML 1.1 plus MathML 2.0 plus SVG 1.1 document, loading the pmathml.xsl stylesheet using 
<?xml-stylesheet type="text/xsl" href="pmathml.xsl" ?>
causes Document methods (specifically document.getElementsByName() ) to fail with a "documents.getElementsByName is not a function" error.
Loading the same xsl stylesheet with 
<link rel="stylesheet" type="application/xslt+xml" href="http://www.w3.org/Math/XSL/pmathml.xsl" />
works ok.


Reproducible: Always

Steps to Reproduce:
(Note:  I don't see how to upload these files, presumably it'll be on submission of the bug report)
1. copy pmathml.xsl to local dir
2. load test1.xhtml into browser
3. loat test2.xhtml into browser
4. Click "Submit answers" in test 1 -> alert will show
5. Click "Submit answers" in test 2 -> alert won't show
Actual Results:  
For the test 2 click, console will show error: "documents.getElementsByName is not a function"

Expected Results:  
Results of test1.xhtml click are the expected results
Attached file required xsl for test
Attached file this file works
Attached file this file doesn't work
Attachment #440759 - Attachment mime type: text/plain → text/xml
Thanks for the report!

I'm somewhat surprised that <link rel="stylesheet" type="application/xslt+xml"> "works OK" - does it actually apply the transformation?

Otherwise, this is the same as bug 230214.
Status: UNCONFIRMED → RESOLVED
Closed: 14 years ago
Component: General → XSLT
Product: Firefox → Core
QA Contact: general → xslt
Resolution: --- → DUPLICATE
Well, honestly, I'm pretty new to this and I'm not sure if it actually works or not.  I don't have IE to check (that's how I'd check, right?).

If there is something that you would like me to do to check please let me know.  You may have to hold my hand a little through it, but hopefully not too much.
Ah, OK. In that case I'll say this more confidently: the XSLT tranform is applied (in Mozilla) only in the case you use the processing instruction (<?xml-stylesheet?>).

So when it *is* applied, what you see in the browser is the result of the transformation, which is not an HTML document (per bug 230214), and does not have HTML-specific properties and methods.

When you use <link rel="stylesheet">, you end up seeing the original document without any transformations applied, which is an HTML document.

I don't know anything about the specific XSLT transform you're using, so can't comment on the best way to use it.

If you have other questions, feel free to ask (here, but better on the relevant Mozilla mailing lists and -- if the question is not mozilla-specific -- on general forums, like stackoverflow.com)
Nickolay,

Thanks for the explanation.  It makes more sense now.  One of the main reasons I opened the bug was that I titled it using the search terms I used to try to determine what was wrong.  Hopefully this entry will help someone else.

Best regards,

Dan
You're welcome, and thanks for taking time to file the bug!
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: