Fixes duplicate output for non-xml nodes, fixes #2139