Re: Selecting the first node set
What you probably want is this ( * will return the first node with any name):
Or, more specific, this (specifying that you only want the first unknown node):
Both return /Trade/UnknownName1/Value/enum - A /Trade/UnknownName1/Value/enum - B /Trade/UnknownName1/Value/enum - C
If you only want the parent, you can, of course, do this (will return one node):
>> /Trade//Value - returns all 3 <Value> nodes
Correct, // means "descendant or self", does not matter how deep, it will return any Value node 'under or on' "Trade"
>> /Trade//Value - also returns all 3 <Value> nodes (why is that ?)
Correct, again "descendant or self". In this case, it is 'self' that is returned, because 'self' is the first node under 'UnknownNode' each time.
>> /Trade//Value - returns nothing (why is that ?)
There is no second node under 'UnknownNode'. If this were your input document, itreturn something:
Cheers, Abel Braaksma www.nuntia.nl
Fraser Goffin wrote:
Given the following simplified XML instance, can anyone suggest an expression that will return ONLY the 'Value' node containing <enum> children with values A, B and C. I can't rely on the name of the parent node of <Value> hence I have deliberately named these as UnknownNameX or any other intervening structure.
PURCHASE STYLUS STUDIO ONLINE TODAY!
Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!
Download The World's Best XML IDE!
Accelerate XML development with our award-winning XML IDE - Download a free trial today!
Subscribe in XML format