Here is an excerpt of my xml :
content
You could do it this way:
../node[not(text()) and preceding-sibling::node[@id][1][@id='1']]
where '1'
is the id of the current node (generate the expression dynamically).
The expression says:
If you are in XSLT you can select from the following-sibling axis because you can use the current()
function:
or simpler (and more efficient) with a key: