The Author operation SurroundWithFragmentOperation has only one argument:
The XML fragment that will surround the selection. For example let's consider the fragment:
<F> <A></A> <B> <C></C> </B> </F>
and the document:
<doc> <X></X> <Y></Y> <Z></Z> <doc>
Considering the selected content to be surrounded is the sequence of elements X and Y, then the result is:
<doc> <F> <A> <X></X> <Y></Y> </A> <B> <C></C> </B> </F> <Z></Z> <doc>
Because the element A was the first leaf in the fragment, it received the selected content. The fragment was then inserted in the place of the selection.