Closed Bug 53327 Opened 24 years ago Closed 24 years ago

string() function incorrectly appends non-text node values

Categories

(Core :: XSLT, defect, P3)

x86
Windows 2000
defect

Tracking

()

VERIFIED FIXED

People

(Reporter: jjs, Assigned: axel)

References

()

Details

Attachments

(1 file)

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
Have a patch. But cvs diff is failing with timeout to cvs server. Will try 
tomorrow.
Attached patch PatchSplinter Review
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. 
Oops...I meant all decendants, luckily thats what the patch does.
Keywords: patch
kvisco@ziplink.net - what's the score with this patch? :-)

Gerv
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
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. :)
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
Fix checked in.

Axel

ohoh, this bug was never new. I'll learn to push the right buttons some day
Status: UNCONFIRMED → RESOLVED
Closed: 24 years ago
Resolution: --- → FIXED
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.

Attachment

General

Creator:
Created:
Updated:
Size: