King Nak wrote:
ok, I found an error in my second xpath expression.
After getting the list of elements having a uid attribute, I used "//[EMAIL
PROTECTED]
= myuid]" on it.
That started searching for elements at the root again, what I wanted to
avoid.
Now I'm using "[EMAIL PROTECTED] = myuid]" instead, what also doesn't work
properly.
The problem is, that in XPath::findChildren, a tester is used to check all
child elements of the context node
if the element's names match (since I'm using a *, all elements match).
It uses
child = context->getFirstChild()
to get the first element, and then
child = child->nextSibling()
to iterate thru the elements.
That's because the expression "[EMAIL PROTECTED] = myuid]" is equivalent to
"child::[EMAIL PROTECTED] = myuid]", which explains why the code works the way it does.
You probably want "self::[EMAIL PROTECTED] = myuid]" instead.
But this nextSibling() returns the next sibling in the original document,
not the next element in the nodeset!
I don't understand what you're saying here. The nodes are all nodes from
the original document.
so only the two products are found (because they're siblings in the
document) but not the articles
(which would be in the nodeset, but are children of the products in the
document)
is there a workaround for this problem?
It's not a problem -- Xalan-C is correctly evaluating the XPath expression
you provided. The problem is you don't have a clear understanding of how
XPath works.
Instead of spending lots of time debugging Xalan-C and attempting to
reverse-engineer behavior, you'd probably be better off figuring out what
XPath expressions you need to get the results you want.
Dave