func MoveFunc(what, where xml.Node, position Position) { switch position { case BOTTOM: where.AddChild(what) case TOP: firstChild := where.FirstChild() if firstChild == nil { where.AddChild(what) } else { firstChild.InsertBefore(what) } case BEFORE: where.InsertBefore(what) case AFTER: where.InsertAfter(what) } }