[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] XPath question
Hi everyone,
I have a XPath problem that "should" be reasonably easy to solve, but so far has just left me scratching my head. Given the following XML* <data> <a> <b/> </a> <a> <b> <c/> <b/> </a> <a> <b/> <b> <c/> <b/> </a> </data> * Note that this is just an example, the structure of the XML I'm working with changes each time. Having said that, there are always 1 or more "a" nodes, "a" nodes contain "b" nodes and there are always 1 or more "b" nodes, "b" nodes contain "c" nodes and a "c" node is either present or not present. I am trying to create an XPath statement that selects the "c" node child of the first "b" node child (that has a "c" node child) of the first "a" node (that has a "b" node child, that in turn has a "c" node child). If that makes any sense :) Note that I would just like to select 1 "c" node, as opposed to the set of "c" nodes. I tried the following statement... /data/a[1]/b[1]/c ....and while (if it works) it only selects 1 node, it just selects the first "a" node regardless of whether or not it contains a "b" node (and regardless of whether or not that "b" node contains a "c" node). In other words it only works if the first "a" node contains a "b" and that "b" node contains a "c" node, otherwise it fails. I've tried so many variations on this statement that I've lost count, but so far I haven't been able to get it do what it needs to. If anyone could let me know what the solution is here, or even just point me in the right direction, your assistance would be greatly appreciated. Thanks! _________________________________________________________________ realestate.com.au: the biggest address in property http://ninemsn.realestate.com.au
|
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
|