This week's book giveaway is in the Mac OS forum. We're giving away four copies of a choice of "Take Control of Upgrading to Yosemite" or "Take Control of Automating Your Mac" and have Joe Kissell on-line! See this thread for details.
Since you've attached a predicate to "second", that is going to result in a set of "second" element nodes. So you're asking for /Query/first/second elements which satisfy a particular complicated condition, and then find their value children which satisfy another particular condition. But since there aren't any "second" elements which have "value" children, you get an empty nodeset. Regardless of whatever that complicated condition was supposed to do. (And since no "second" element has a "row" element as an ancestor, you probably have that wrong as well.)
I also don't understand why you have a predicate which is looking for "value" elements with 'dddd' as the value. You said
i am currently at the highlighted position in the above xml
Should we take that to mean that the current node in your XSLT processing is that element? You didn't mention XSLT but what are we to make of that statement otherwise?
And if the current node for your XPath is what you say it is, then why not just this?
Joined: Aug 20, 2011
Thanks for your reply.
Let me explain you what i am trying to achieve.
so from that xml i want those two values which i highlighted in this format :- dddd:aaaa
so i have written two methods:
In my first method (Working fine) i have written one XPath :
/Query/first/second/row/third/value[.='"+cba+"'] -> the value for cba can be changed, so i am taking it as an string type argument.
In my second method (facing issues) : i am trying to write XPath on top of my first method XPath.
Here are my expectations from my second method.
In my second method XPath it should go in that particular row element nodes for which the value for value tag is matched to cba.
and from that row element nodes i want value from attrID tag or say any other tag.
i know it is quite confusing and complex
Joined: Aug 20, 2011
if it is confusing, in little words this is what i am trying to achieve.
From my xml whichever value tag <value></value> has text which i am passing to the method with argument cba, From that row block only <row className="" id=""> i want to get the text of value tag <value></value> which has key <key></key> text as value
I think I understand. For others who might want to work on this: when you say "From" you don't mean you want to navigate from that location to another location. You mean you want to extract data from that location and then navigate from the root element to another location. Right? If so then why not this?
subject: issue in xpath while getting ancestor's sibling