Closed Bug 338398 Opened 19 years ago Closed 19 years ago

elements with the same name get nested wrong

Categories

(Core :: XSLT, defect)

x86
Windows XP
defect
Not set
normal

Tracking

()

RESOLVED INVALID

People

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

References

()

Details

Attachments

(4 files)

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.
Attached file sample xml content
Attached file sample xsl file
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
Closed: 19 years ago
Resolution: --- → INVALID
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: