What expression would select all text nodes which are:
a
, or script
o
This should do, assuming "not inside" means the text node is not supposed to be a descendant of an "a" or "script" or "style" element. If "not inside" only means not supposed to be a child then use parent::a and so on instead of ancestor::a.
//text()[normalize-space() and not(ancestor::a | ancestor::script | ancestor::style)]