fix infinite recursion, make work with text nodes

also fix readme example