Closed Bug 297067 Opened 20 years ago Closed 20 years ago

First tag is not transformed

Categories

(Core :: XSLT, defect, P3)

PowerPC
macOS
defect

Tracking

()

RESOLVED FIXED
mozilla1.9alpha1

People

(Reporter: mozilla, Assigned: peterv)

Details

Attachments

(3 files)

User-Agent: Mozilla/5.0 (Macintosh; U; PPC Mac OS X Mach-O; en-US; rv:1.7.8) Gecko/20050511 Firefox/1.0.4 Build Identifier: Mozilla/5.0 (Macintosh; U; PPC Mac OS X Mach-O; en-US; rv:1.7.8) Gecko/20050511 Firefox/1.0.4 The first tag in a template is ignored Reproducible: Always Steps to Reproduce: 1.Create two text files, test.xml and test.xsl 2.Insert the text in the "Additional Information" field 3.Drop the file test.xml into the browser Actual Results: Only line 2 is displayed Expected Results: Lines 1 and 2 should be displayed test.xml ________ <?xml version="1.0" encoding="utf-8"?> <?xml-stylesheet type="text/xsl" href="test.xsl"?> <r> <line1>Line 1</line1> <line2>Line 2</line2> </r> ________ test.xsl ________ <?xml version="1.0" encoding="utf-8"?> <xsl:stylesheet version='1.0' xmlns:xsl='http://www.w3.org/1999/XSL/Transform'> <xsl:output method="html" indent="no" version="4.0" omit-xml-declaration="yes" encoding="utf-8" doctype-public="-//W3C//DTD XHTML 1.1//EN" doctype-system="http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd"/> <xsl:template match="r"> <p> <xsl:value-of select="line1"/> </p> <p> <xsl:value-of select="line2"/> </p> </xsl:template> </xsl:stylesheet>
Please attach your testcase rather then including it in a comment. The main problem is that you're not creating a complete html document. But it should work fine anyway so there might be a bug here.
wouldn't this xslt sheet create a doc with two root elements?
No, since the XSLT spec says that stuff like this is allowed we create a <transformiix:result>-element and stick everything inside of that in cases like this.
(In reply to comment #1) > Please attach your testcase rather then including it in a comment. The main > problem is that you're not creating a complete html document. But it should work > fine anyway so there might be a bug here. I kept the example as simple as possible; putting in <html> etc. tags doesn't change anything. However if you insert something like <z></z> at the beginning of the template, then it works as it should because then this tag is ignored instead.
As I said before, attach a testcase. Preferably using the guidelines in http://www.mozilla.org/projects/xslt/bug-reporting.html
And preferably both with and without a <html> tag
Attached file XML file
<P> Line 1</P> <result> <P> Line 2 </P> </result> is the result im DOM inspector. We actually end up with three top-level children for the doc. html, p and tx:result. tx:result being the document element, and thus the only one displayed. Bad foo in our result copying when faking the doc element. Should we do something clever for html output method?
Status: UNCONFIRMED → NEW
Ever confirmed: true
Attached file XSL stylesheet
Could we get a testcase with a wrapping <html> too since that was apparently also a problem (which might or might not be related)
This is caused by the doctype. When we rewrap the content into a wrapper element, we try to append all the content in the document to the element. Some of the document's content is not allowed in an element (like doctypes), so the append fails.
Status: NEW → ASSIGNED
Priority: -- → P3
Target Milestone: --- → mozilla1.9alpha
Attached patch v1Splinter Review
Attachment #195380 - Flags: review?(axel)
Comment on attachment 195380 [details] [diff] [review] v1 Not that this is really perf critical, but do we have ENTITY_REFERENCE_NODEs at all?
Attachment #195380 - Flags: review?(axel) → review+
Comment on attachment 195380 [details] [diff] [review] v1 We have no ENTITY_REFERENCE_NODE nodes, but I copied this from AppendChild and we might have them someday.
Attachment #195380 - Flags: superreview?(jst)
Attachment #195380 - Flags: superreview?(jst) → superreview+
Status: ASSIGNED → RESOLVED
Closed: 20 years ago
Resolution: --- → FIXED
Thanks to whoever resolved the bug. I originally reported it, perhaps not as clearly as I might have done. The public is invited to report bugs but we're not all Mozilla experts! Kind regards to all, John.
Is this patch missing a break somewhere? We fall into the default case (and increment j) for all node types, no?
I'm going to add said break in bug 323311, for what it's worth.
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: