User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.5) Gecko/20031007 MultiZilla/220.127.116.11e
Build Identifier: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.5) Gecko/20031007 MultiZilla/18.104.22.168e
When transforming using XSLT client-side to XHTML, the HTML-DOM is not
implemented for the result tree. This is not the case when XHTML is served directly.
This means, for example, you cannot access document.body in XHTML results of
XSLT Transformations, but you CAN access document.body when the document is
served as XHTML.
Steps to Reproduce:
1. Transform an XML document to XHTML
2. Try to access the DOM
Error: document.body has no properties
Source File: http://pixelated-dreams.com/p-d.js
It should have created the DOM and the document.body node should have been there.
You can work around this problem in particular by putting an id on the body
element and using:
we should instantiate a real xhtml-document when the root element is an
xhtml:html element. Same goes for svg-documents.
There appears to be no workaround for document.cookie , at least until
DOMImplementation.getFeature() is implemented.
This means a choice between client-side transformation, and client-side scripts
using cookies. Tbh, I'd rather have both.
*** Bug 325835 has been marked as a duplicate of this bug. ***
*** Bug 346886 has been marked as a duplicate of this bug. ***
Is Bug 303557 have a same reason ?
(In reply to comment #2)
> There appears to be no workaround for document.cookie , at least until
> DOMImplementation.getFeature() is implemented.
Just to clear this up, the getfeature method is implemented. However, there is no access to cookies using that interface.
This is the only bug that's preventing me from migrating the whole controlled environment (internal application) from XML/XSLT/HTML to XML/XSLT/XHTML. The workaround to most everything except cookies - i.e. not using HTML DOM, even though theoretically possible, is not practical especially when existing applications are written to the HTML DOM.
Finally, Mozilla already renders the XHTML generated this way as HTML - e.g. HTML forms, elements, etc. are all there. Why can't the logic that decides how to render the document and the logic that decides what DOM objects to instantiate as a result of it be consistent with each other? And if the way it currently works is wrong (i.e. it should not be rendering as HTML because it doesn't "recognize" the HTML document) then why can't the logic be based on xsl:output method (xml), media-type (application/xhtml+xml) and the existence of the root xhtml:html element?
It seems like a relatively easy solution to a bug that's been open for almost 3 years.
Also, there can be used doctype-system attribute of xsl:output element to generate DOCTYPE (for example, see attachment https://bugzilla.mozilla.org/attachment.cgi?id=233758 of Bug 346886).
BTW, I would have been expecting a recursive transformation when the output XML have a stylesheet reference :)
(In reply to comment #7)
> BTW, I would have been expecting a recursive transformation when the output XML
> have a stylesheet reference :)
No, see http://www.w3.org/TR/xslt#data-model ("Processing instructions and comments in the stylesheet are ignored").
pixelated-dreams.com doesn't use anything XSLT related afaics.
Example of recursive transformation.
Source xml document, fragment:
<?xml version="1.0" encoding="ascii" ?>
<?xml-stylesheet type="text/xsl" href="struct-pre.xsl"?>
The struct-pre.xsl document, fragment:
<xsl:output omit-xml-declaration="no" />
<xsl:template match="/" >
Тow, the output xml document will get xml-stylesheet instruction and may have next transformation with struct-second.xsl.
Ah, yes. I don't think we'll support that, if you want to pipeline do it on the server.
(In reply to comment #11)
> Ah, yes. I don't think we'll support that, if you want to pipeline do it on the
Created attachment 249764 [details]
Main XML for test case
Created attachment 249765 [details]
XSLT for test case
(In reply to comment #9)
> pixelated-dreams.com doesn't use anything XSLT related afaics.
So that we don't have to rely on original reporter's URLs remaining the same throughout, I uploaded the XML and XSLT files that can be used to reproduce the behavior described.
Created attachment 249777 [details]
Main XML for test case
Modified stylesheet URI in the XML so that it points to the uploaded XSL on bugzilla.
Pipelineing has nothing to do with this bug. Feel free to file a separate bug on it.
Created attachment 327530 [details]
One way to work around the issue is to grab an HTML DOM from a nested HTML object and add the setter and getter for document.cookie.
I should clarify that the attached workaround is only for document.cookie, not for all of the missing HTML DOM properties and methods.
*** Bug 561083 has been marked as a duplicate of this bug. ***
I can't believe this bug is still not fixed. It should be simple. Cmon Mozilla. Chrome has done it. IE is in even worse shape, as expected.