xml template accept XMLDocument instance for selection.
fix cXMLTemplateAction_merge, check childs if no selection
fix for NULL optional fileds in makeFormView function