elements with the same name get nested wrong




13 years ago
13 years ago


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


Windows XP

Firefox Tracking Flags

(Not tracked)




(4 attachments)



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

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:
test.html uses content.xml and test.xsl

Here is an example of inline transformation, wich works properly:
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.

Comment 1

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

Comment 2

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

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.
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.