Closed Bug 72810 Opened 25 years ago Closed 24 years ago

count() function is unable to handle certain path expressions

Categories

(Core :: XSLT, defect, P2)

defect

Tracking

()

VERIFIED FIXED
mozilla0.9.2

People

(Reporter: wschmid, Assigned: peterv)

Details

(Keywords: testcase, Whiteboard: Fix in hand. Have r=sicking, sr=jst. Need a=.)

Attachments

(8 files)

See attached XML/XSL files.
Attached file Simple XML input
Attached file XSL input file
Attached file Expected output
Keywords: mozilla0.8, testcase
This works fine up to the point where we try to evaluate the argument to the count() function. The reason for this problem seems to be the context node, which is the xsl:variable node. Heck, that's part of the stylesheet, that can't be right, hu? But what is the right context node? This is called from processTopLevel, and I poked the spec without any luck about what the context node should be, as we don't instantiate any template yet. Should we take the source doc in this case? stack trace: (for a slightly modified version, using a select attribute) #0 NodeSetFunctionCall::evaluate (this=0xb1e00, context=0xb4fa0, cs=0xffbef3c0) at /home/ah/source/XSLT/thirdtree/mozilla/extensions/transformiix/source/xpath/NodeSetFunctionCall.cpp:95 #1 0x87598 in XSLTProcessor::processVariable (this=0xffbef8b0, node=0xb4fa0, xslVariable=0xb4fa0, ps=0xffbef3c0) at /home/ah/source/XSLT/thirdtree/mozilla/extensions/transformiix/source/xslt/XSLTProcessor.cpp:1603 #2 0x8268c in XSLTProcessor::processTopLevel (this=0xffbef8b0, stylesheet=0xb1da0, ps=0xffbef3c0) at /home/ah/source/XSLT/thirdtree/mozilla/extensions/transformiix/source/xslt/XSLTProcessor.cpp:493 #3 0x81dc4 in XSLTProcessor::processTopLevel (this=0xffbef8b0, xslDocument=0xb14f8, ps=0xffbef3c0) at /home/ah/source/XSLT/thirdtree/mozilla/extensions/transformiix/source/xslt/XSLTProcessor.cpp:379 #4 0x82c94 in XSLTProcessor::process (this=0xffbef8b0, xmlDocument=@0xaf458, xslDocument=@0xb14f8, out=@0xab8c0) at /home/ah/source/XSLT/thirdtree/mozilla/extensions/transformiix/source/xslt/XSLTProcessor.cpp:595 #5 0x8329c in XSLTProcessor::process (this=0xffbef8b0, xmlInput=@0xae938, xmlFilename=@0xae318, xslInput=@0xffbef780, xslFilename=@0xae330, out=@0xab8c0) at /home/ah/source/XSLT/thirdtree/mozilla/extensions/transformiix/source/xslt/XSLTProcessor.cpp:680 #6 0x8c58c in main (argc=5, argv=0xffbef98c) at /home/ah/source/XSLT/thirdtree/mozilla/extensions/transformiix/source/main/transformiix.cpp:135
Status: UNCONFIRMED → NEW
Ever confirmed: true
Keywords: mozilla0.8, testcase
doing milestone, and partially keywords that didn't survive midair. My stacktrace wins ;-)
Keywords: testcase
Target Milestone: --- → mozilla0.9
This should be fixed with the new parser
Depends on: 75102
ignore me :(
No longer depends on: 75102
The context node and context node list should be the rootnode of the source document per http://www.w3.org/TR/xslt#top-level-variables
Yep XSLTProcessor::processTopLevel is definately wrong, the source document node should be passed in as a parameter: something like: processTopLevel(Document* source, Document* stylesheet, ProcessorState* ps); -and- processTopLevel(Document* source, Element* stylesheet, ProcessorState* ps); then lines 423 and 503 both need to be changed to: ExprResult* exprResult = processVariable(source, node, ps); and line 565 should be changed to: processTopLevel(&xmlDocument, &xslDocument, &ps); That should fix it. --Keith
Status: NEW → ASSIGNED
Are you still shooting for 0.9 on this? If so please email drivers@mozilla.org with a status on you progress. If not please retarget against a later Milestone. Thanks.
retargeting. Axel
Target Milestone: mozilla0.9 → mozilla0.9.1
is this on track for landing in the next week or so? if not lets unset the target milestone until we get a good plan in place.
I'll try out the suggestion and make a patch.
Assignee: kvisco → peterv
Status: ASSIGNED → NEW
Target Milestone: mozilla0.9.1 → mozilla0.9.2
Status: NEW → ASSIGNED
Priority: -- → P2
Attached patch FixSplinter Review
I just copied what Keith wrote (with some clean-up). Seems to work :).
We need both processTopLevel functions, the one that takes an element is needed for embedded stylesheets (spec section 2.7) and the one that takes a document is a great place to support LRE stylesheets (spec section 2.3) Also would you mind setting the context nodeset and xslt-current node so that we get the following variables right? <xsl:variable select="position()"/> <xsl:variable select="last()"/> <xsl:variable select="current()"/> The context nodeset should be a nodeset containing only the root-node of the source document
/me tries to scare peterv. Could a embedded stylesheet be a 2.3 LRE? It doesn't say so in 2.7, but ??? Axel
r=me, once you add NS_ASSERTION for aStylesheet, too. The documentElement stuff can be done either here, or in 85408, whichever Axel
ugh, I hate to do this, but I still have a complaint :( Why do the push/pop for every variable and not just once around the initial call to processTopLevel. That way we would also get the right current nodelist for the initial templatematching. Also, it's the sourcedocs root-node that should be the current node and context nodelist, not it's documentelement.
Attached patch Fourth trySplinter Review
/me slaps peterv what part of "root-node" don't you understand ;) instead of + sourceRoot = sourceDocument->getFirstChild(); + NS_ASSERTION(sourceRoot, "source document has no root node"); + if (sourceRoot) { + nodeSet.add(sourceRoot); + ps->pushCurrentNode(sourceRoot); + } just do + nodeSet.add(sourceDocument); + ps->pushCurrentNode(sourceDocument); :) other then that, r=sicking
:). Right, right. I think I'll go have some sleep now.
Whiteboard: Fix in hand. Have r=sicking. Need sr=, a=.
Attached patch Final patchSplinter Review
sr=jst
Whiteboard: Fix in hand. Have r=sicking. Need sr=, a=. → Fix in hand. Have r=sicking, sr=jst. Need a=.
Checked in.
Status: ASSIGNED → RESOLVED
Closed: 24 years ago
Resolution: --- → FIXED
bitching buttons, verfication spam
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: