Closed Bug 346886 Opened 18 years ago Closed 18 years ago

Various issues when using xslt to render html

Categories

(Core :: XSLT, defect)

1.8 Branch
x86
Windows XP
defect
Not set
normal

Tracking

()

RESOLVED DUPLICATE of bug 230214

People

(Reporter: ruvim.pinka, Unassigned)

References

()

Details

Attachments

(3 files)

User-Agent:       Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.0.5) Gecko/20060719 Firefox/1.5.0.5
Build Identifier: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.0.5) Gecko/20060719 Firefox/1.5.0.5

There malformed rendering of a dynamicly added elements, when document created from XML by XSLT.



Reproducible: Always

Steps to Reproduce:
1. Open test.xml by above url

Actual Results:  
test 1test 2

Expected Results:  
test 1
test 2


Please, see a files at http://www.forth.org.ru/~ruvim/test/FF/html-xsl/DOM/
The xsl stylesheet simply output a test.html document:
<xsl:template match="/" >
  <xsl:copy-of select="document('test.html')" />
</xsl:template>
So, we can compare results by open test.html and test.xml.

It seems, there general problem for several bugs. I have found following similar bugs, which yet exist (I have sured): #270223, #303557, #315747, #335622, #315799.
Test an auto link: Bug 346886
A list of similar bugs:
Bug 270223 
Bug 303557
Bug 315747
Bug 315799
Bug 335622
Assignee: nobody → xslt
Component: General → XSLT
Product: Firefox → Core
QA Contact: general → keith
Version: unspecified → 1.8 Branch
Please attach the testcase to this bug so that it doesn't get lost if the site changes.
The problem is that you're trying to load a HTML document using document(). document() only supports loading of XML documents.
(In reply to comment #7)
> The problem is that you're trying to load a HTML document using document().
No.  There is an XML document. Please, see a source of https://bugzilla.mozilla.org/attachment.cgi?id=233753
Attachment #233753 - Attachment mime type: text/html → text/xml
Anything sent as 'text/html' is interpreted as HTML, not XML. I still see the issue even after fixing that though.
Attachment #233753 - Attachment mime type: text/xml → application/xhtml+xml
I bet the problem is the createElement calls. We load the document as pure XML, and so createElement creates elements in the null namespace, not in the XHTML namespace. I'd say this is INVALID or WONTFIX, you can easily use createElementNS with the XHTML namespace.
The issue here is that test.html looks like an xhtml document, but is served using 'text/html'. This means that when test.html is loaded directly we treat it as a HTML document and so createElement('p') works. However when the document is loaded using XSLT it is treated as XML (or specifically XHTML) and so you need to call createElementNS('http://www.w3.org/1999/xhtml', 'p').

Alternatively you could remove the xmlns attribute from test.html which would put it in the null namespace when loaded by XSLT making the XSLT create a HTML document.

All this is per spec btw.


However, firefox does let you call createElement('p') in a real XHTML document, so the testcase should ideally work because of that. However due to bug 230214 it does not. So marking a duplicate of that bug.

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

Attachment

General

Creator:
Created:
Updated:
Size: