elements with the same name get nested wrong

RESOLVED INVALID

Status

()

RESOLVED INVALID
13 years ago
13 years ago

People

(Reporter: SP-bugzilla.mozilla.org, Unassigned)

Tracking

Trunk
x86
Windows XP
Points:
---

Firefox Tracking Flags

(Not tracked)

Details

(URL)

Attachments

(4 attachments)

(Reporter)

Description

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

I have found the bug in a more complex environment and tried to strip it down to a simple example. 

I used XSL to iterate through a set of elements (level1) for each level1 element I created a div and within this div I created a div which should contain the level2 elements according to the current level1. Within this div I applied the template for the level2 elements. Whenever there are no level2 elements for a level1 element, there is an empty div and if this is the case, the level1 div is not closed immediately so that the complete following content is nested under this level1.

This behaviuor only occurs if I do the xsl transformation with javascript. If I import the xsl within the xml, it works properly.

Here you can see the problem:
http://markus.renschler.net/bugzilla/test.htm
test.html uses content.xml and test.xsl

Here is an example of inline transformation, wich works properly:
http://markus.renschler.net/bugzilla/content2.xml
content2.xml is an exact copy of content.xml which additionally imports test.xsl.

There is no problem if the nested tag (class="sublevels") is a "p" (for example).

Reproducible: Always

Steps to Reproduce:
See my examples.
(Reporter)

Comment 1

13 years ago
Created attachment 222472 [details]
sample xml content
(Reporter)

Comment 2

13 years ago
Created attachment 222473 [details]
sample xsl file
(Reporter)

Comment 3

13 years ago
Created attachment 222474 [details]
sample html file with javascript xsl transformation
The nesting is correct, but you're transforming to HTML into an XML document, serializing that as XML and then parsing it as HTML again using innerHTML. Along the way, you end up with an empty div element which is <div /> in XML but gets parsed as an open div tag in HTML. If you try loading the serialisation of the transformed document as HTML directly you'll end up with the wrong nesting too.
Status: UNCONFIRMED → RESOLVED
Last Resolved: 13 years ago
Resolution: --- → INVALID
Created attachment 222479 [details]
resulting document as HTML
You need to log in before you can comment on or make changes to this bug.