Arguments of SurroundWithFragmentOperation
- 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 elementsX
andY
, 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.Note: If the first leaf is not the desired location for the surrounded fragment, you can use ro.sync.ecss.extensions.commons.operations.InsertOrReplaceFragmentOperation and set the following arguments:- fragment
- The XML fragment that will surround the selection. Use the
${selection}
editor variable in the location you want to place the surrounded fragment. - schemaAware
- Set it to false to avoid moving the fragment if it is not valid at the given location.
- schemaAware
- This argument applies only on the surround with element
operation and controls whether or not the insertion is valid, based upon the schema. If the
insertion is not valid, then wrapping action will be broken up into smaller intervals until
the wrapping action is valid. For example, if you try to wrap a paragraph element
with a bold element, it would not be valid, so the operation will wrap the text
inside the paragraph instead, since it would be valid at that position.Note: If a selection exists, the surround with fragment operation is not schema aware.