Bennett writes: >How do I get the names of all elements on the same "vertical slice" [i.e., depth in the tree] >that <b> and <e> are on? >...Note: the names of the elements aren't static...
So I guess you're talking about having an element as the current node, and you want to find its depth. That would be: count(ancestor::*) which you could save in a variable $depth. Then the set of all elements at that depth can be found expensively via //*[count(ancestor::*) = $depth] but any attempt to find a slice is likely to be expensive. .................David Marston