What expression would select all text nodes which are:
a, or script o
I used Dimitre Novatchev's answer, but then i stumbled upon the problem described by the topic starter:
not descendant of
a,styleorscript
Dimitre's answer excludes style tag but includes its children.
This version excludes also style, script, noscript tags and their descendants:
//div[@id='???']//*[not(ancestor-or-self::script or ancestor-or-self::noscript or ancestor-or-self::style)]/text()
Anyway, thanks to Dimitre Novatchev.