[Home] [By Thread] [By Date] [Recent Entries]
Hi Fraser,
What you probably want is this ( * will return the first node with any name): /Trade/*/Value/enum Or, more specific, this (specifying that you only want the first unknown node): /Trade/*[1]/Value/enum Both return /Trade[1]/UnknownName1[1]/Value[1]/enum[1] - A /Trade[1]/UnknownName1[1]/Value[1]/enum[2] - B /Trade[1]/UnknownName1[1]/Value[1]/enum[3] - C If you only want the parent, you can, of course, do this (will return one node): /Trade/*[1]/Value >> /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[1] - 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[2] - returns nothing (why is that ?) There is no second node under 'UnknownNode'. If this were your input document, itreturn something: <Trade> <UnknownName1> <Value> <enum>A</enum> <enum>B</enum> </Value> <Value> <enum>C</enum> </Value> </UnknownName1> </Trade> HtH, 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.
|

Cart



