fix for adding new element by xpath

used to always add element to end even when that was the incorrect placement
Possible fix for deleting elements with transaction
Fix for REference System Code disappear after csw-T update

Fixes: https://jira.swisstopo.ch/browse/GEOCAT_SB-57