hi nightinggale, thank you very much for your help and apologies about the lack of clarity. the sample bits of code were great, but best of all was the general description of how the code interacts with the data in the XML. common CTDs i've experienced are now glaringly obvious!
thanks guv x