Closed
Bug 212903
Opened 22 years ago
Closed 21 years ago
XSLT bug -- incorrectly added <meta> element to results tree
Categories
(Core :: XSLT, defect, P3)
Core
XSLT
Tracking
()
RESOLVED
FIXED
mozilla1.6alpha
People
(Reporter: ian.graham, Assigned: peterv)
Details
Attachments
(2 files, 1 obsolete file)
1.17 KB,
application/x-zip-compressed
|
Details | |
5.44 KB,
patch
|
axel
:
review+
peterv
:
superreview+
|
Details | Diff | Splinter Review |
I start with XML data rawdata.xml
<?xml version="1.0" ?>
<?xml-stylesheet href="transform-raw.xsl" type="text/xsl" ?>
<stuff>
<data> data inside stuff </data>
</stuff>
and the transform transform-raw.xsl
<?xml version="1.0" ?>
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns="http://www.w3.org/1999/xhtml" >
<xsl:output method="xml" indent="yes" />
<xsl:template match="/">
<html> <head>
<title> Namespace Fun and Frolic #1 </title>
</head> <body>
<xsl:value-of select="//data" />
</body> </html>
</xsl:template>
</xsl:stylesheet>
I now load rawdata.xml into Mozilla (1.4), which automatically
loads the stylesheet transform-raw.xsl, and displays the generated
results (just the string 'data inside stuff').
I now use Martin Honnen's javascript: bookmark trick [1] to display
the XML results tree. THe result is:
<a0:html xmlns:a0="http://www.w3.org/1999/xhtml"><a0:head>
<meta http-equiv="Content-Type" content="text/xml; charset=UTF-8"/>
<a0:title> Namespace Fun and Frolic #1 </a0:title>
</a0:head><a0:body> data inside stuff </a0:body></a0:html>
The question: where did the <meta> element come from? As far
as I can tell, it shouldn't be there. This looks like an XSLT
bug to me ....
I will attach the example files as a zipped attachment.
Reporter | ||
Comment 1•22 years ago
|
||
![]() |
||
Updated•22 years ago
|
OS: Windows 98 → All
Hardware: PC → All
There are two problems with the current code. First of all we should only add
the <meta> in html-output. Second we need to honor the mDocumentIsHTML-flag.
I'll whip up a patch
Assignee: peterv → bugmail
this was mostly fixed by bug 207377, in there i added a test to make sure that
the meta is only added during html-output. We still need test mDocumentIsHTML though
Assignee | ||
Comment 4•21 years ago
|
||
Assignee | ||
Updated•21 years ago
|
Attachment #131032 -
Flags: superreview?(jst)
Attachment #131032 -
Flags: review?(bugmail)
Assignee | ||
Comment 5•21 years ago
|
||
Taking.
Assignee: bugmail → peterv
Priority: -- → P3
Target Milestone: --- → mozilla1.6alpha
Assignee | ||
Updated•21 years ago
|
Status: NEW → ASSIGNED
Comment 6•21 years ago
|
||
Comment on attachment 131032 [details] [diff] [review]
v1
- In txMozillaXMLOutput.h:
+ nsresult createHTMLElement(const nsAString& aName,
+ nsIDOMElement** aResult)
+ {
+ if (mDocumentIsHTML) {
+ return mDocument->CreateElement(aName,
+ getter_AddRefs(aResult));
+ }
+
+ return
mDocument->CreateElementNS(NS_LITERAL_STRING(kXHTMLNameSpaceURI),
+ aName, getter_AddRefs(aResult));
+ }
I'd uninline this code, for two reasons. It's not performance critical (at
least not to the point where wether this method is inlined or not matters), and
that NS_LITERAL_STRING expands to a non-trivial ammount of code on some
platforms. But either way works for me...
sr=jst
Attachment #131032 -
Flags: superreview?(jst) → superreview+
Assignee | ||
Comment 7•21 years ago
|
||
Attachment #131032 -
Attachment is obsolete: true
Assignee | ||
Comment 8•21 years ago
|
||
Comment on attachment 131038 [details] [diff] [review]
v1.1
Transfering sr=jst.
Attachment #131038 -
Flags: superreview+
Attachment #131038 -
Flags: review?(axel)
Comment 9•21 years ago
|
||
Comment on attachment 131038 [details] [diff] [review]
v1.1
r=axel@pike.org, I prefer the non-inlined version, too. Esp. as this is going
to go thru more code, once Jonas does his output sink work (getting rid of the
argument to endElement, not calling document.createElement but using element
factories directly)
Attachment #131038 -
Flags: review?(axel) → review+
Assignee | ||
Updated•21 years ago
|
Attachment #131032 -
Flags: review?(bugmail)
Assignee | ||
Comment 10•21 years ago
|
||
Checked in.
Status: ASSIGNED → RESOLVED
Closed: 21 years ago
Resolution: --- → FIXED
You need to log in
before you can comment on or make changes to this bug.
Description
•