Closed Bug 70865 Opened 24 years ago Closed 24 years ago

LocationStep isn't attributefriendly

Categories

(Core :: XSLT, defect)

Other
Other
defect
Not set
normal

Tracking

()

VERIFIED FIXED

People

(Reporter: sicking, Assigned: sicking)

References

Details

Attachments

(3 files)

While walking the tree LocationStep isn't attribute frienly. In many places it does |node = node->getParentNode()| where node could be an attribute. It should rather do |node = cs->getParentNode(node)| . Also the code for following:: (and preceding::) has bugs. There is an |if| that checks if the current node is the last sibling and if so walks to the parent following sibling. However the parent may also be the last sibling so we need a |while| rather then an |if| attaching a patch to fix
Status: NEW → ASSIGNED
Keywords: review
the attached patch dosn't work... will attach new version once I have some more fixes in
the attached patch passes almost all axes tests in buster. The remaing ones I afaict are problems with either whitespace or attribute order. Note that this depends on bug 70979 for module
The patch fixes the following things: 1. The old code didn't work when the contextnode was an attribute. According to the XPath datamodel the parent of an attribute is it's element so we need to use the ContextState::getParentNode(Node*) function rather then Node::getParentNode() when trying to find the parent 2. The FOLLOWING and PRECEDING axes were very broken 3. LocationStep::matches didn't calculate the correct context nodeset when evaluating the predicates
+ NodeSet* nodes = (NodeSet*)evaluate(cs->getParentNode(node),cs); + result = nodes->contains(node); Can evaluate return null? If so, you might want to defend against it. Other than that, sr=shaver.
fix checked in Axel
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

Created:
Updated:
Size: