Question: I have such html files.
Basically it has div containing texts with one inner span and the rest text part has pretty arbitrary format.

```
<html>
<div>
<span class="c1">Text1</span><br/>
Text4<br/>
Text5
</div>
<div>
<span class="c1">TextA</span><a href="...">TextD</a>
</div>
</html>

```

it is trivial to select/print only specific text inside span with
`xml sel -t -m "/html/div" -v "span[@class='c1']" -n`

However I don't know how to select/print the rest text within but outside the span regardless of any other tags like `<br/>`. The function `text()` does not work as I expect.

`xml sel -t -m "/html/div" -v "concat(span[@class='c1'],'|',text(),'$')" -n` will cut text behind `<br/>` tags.

how can I get something like

```
Text1|
Text4
Text5$
TextA|TextD$

```

Answer: 
I've tested some xpath's so the best one which I found is

```
//div/descendant-or-self::*/text()[normalize-space()]

```

![xpath result](https://i.stack.imgur.com/yh9Np.png)

It indicates the context node and all of its descendants, get text values that aren't empty.

about [XPath axis](https://developer.mozilla.org/en-US/docs/Web/XPath/Axes)
Somehow I found a solution with `substring-after`

```
xml sel -t  -m "/html/div" -v "span[@class='c1']" -o '|' -v "substring-after(.,span[@class='c1'])" -n

```

but I would like to know if there is a better way than substr method.