Arguments of SurroundWithFragmentOperation

The Author mode operation SurroundWithFragmentOperation has only one argument:

  • fragment

    The XML fragment that will surround the selection. For example, 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>

    Since 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.

Was this helpful?