I have a fairly deeply nested xml structure and I would like to find an element with a particular value after I have already selected a node. In the sample below I have an array of 'B' and after selecting each of the 'B' nodes I would like to get the text of one of the children (which are not consistent) that starts with the word 'history'
<A> <Items> <B> <C> <D>history: pressed K,E</D> // could be nested anywhere </C> </B> <B> <C> <E>history: pressed W</E> </C> </B> </Items> </A> // Select the nodes from the array (B) var nodes = select(xmldoc, "//A/Items/B"); // Iterate through the nodes. nodes.forEach(node){ // is it possible to select any element that starts with the text 'history' from the already selected node. var history = select(node, "???[starts-with(.,'history')]"); all the samples I have seen start with : //*[text()] which searches from the root of the structure.