string() function incorrectly appends non-text node values

VERIFIED FIXED

Status

()

Core
XSLT
P3
normal
VERIFIED FIXED
18 years ago
17 years ago

People

(Reporter: Jus, Assigned: Axel Hecht)

Tracking

Trunk
x86
Windows 2000
Points:
---

Firefox Tracking Flags

(Not tracked)

Details

(URL)

Attachments

(1 attachment)

(Reporter)

Description

18 years ago
The xsl:value-of select="string()" call on the document node context should 
only return the concaternation of its text-node children. It is incorrectly 
appending comment-node values.

Output should be "xyz"  but is outputs "test comment xyz".

Bit of ivestigation shows that XMLDOMUtils::getNodeValue() with Node::ELEMENT 
does not treat any of its child differently, when it should be only operating 
on testNodes
(Reporter)

Comment 1

18 years ago
Have a patch. But cvs diff is failing with timeout to cvs server. Will try 
tomorrow.
(Reporter)

Comment 2

18 years ago
Created attachment 15199 [details] [diff] [review]
Patch

Comment 3

18 years ago
The string-value of the root node (or Document) is the concatenation of all the 
text node descendants (not just children) of the root node in document order. 
(Reporter)

Comment 4

18 years ago
Oops...I meant all decendants, luckily thats what the patch does.
(Reporter)

Updated

17 years ago
Keywords: patch
kvisco@ziplink.net - what's the score with this patch? :-)

Gerv
(Assignee)

Comment 6

17 years ago
Hrm.
Is this the stylesheet you had in mind?

<?xml version="1.0"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
 <xsl:template match="/">
  <p><xsl:value-of select="string()" />
  </p>
 </xsl:template>
</xsl:stylesheet>


It gives the output

<?xml version="1.0"?>
<p>
   
   x
   y
   z
   
     
   
</p>

which looks ok. Without the patch.
If I horked this test case, please attach a better one.

Axel
(Reporter)

Comment 7

17 years ago
Axel,

As per the URL in the bug
mozilla/extensions/transformiix/source/examples/functions.xml

The test of string() fails as the comment nodes are included in the output and
should not. This patch rectifies it. I downloaded the component on the project
page to check versus my patched one.  The downloaded version is incorrect but my
patched one is fine.

Im unsure if the current patch will actually patch cleanly as I have had the fix
for over a month now, <SULK>and no ones even bothered to confirm this is a
fault, little alone accept it.</SULK>

Ive been busy playing with my mindstorm robotic lego, WBTW is the coolest stuff. :)
(Assignee)

Comment 8

17 years ago
Hi Jus,
sorry, I failed, I must have grep'd the wrong file, I didn't see the string()
function call. I do see the reason for the bug, and how your patch fixes it.
Assign it to me, will check in fix later today.
Sorry for the delay, I have attempted other things (and failed :-( )

Axel
Assignee: kvisco → axel
(Assignee)

Comment 9

17 years ago
Fix checked in.

Axel

ohoh, this bug was never new. I'll learn to push the right buttons some day
Status: UNCONFIRMED → RESOLVED
Last Resolved: 17 years ago
Resolution: --- → FIXED
(Reporter)

Comment 10

17 years ago
Alex,

No problemo and thanks. :)
Hmm, wonder what this button does. "Mark bug as VERIFIED", sounds cool.
Status: RESOLVED → VERIFIED
You need to log in before you can comment on or make changes to this bug.