Thomas Dumm wrote:
> Dear Mr Shafie,
>  
> Is there a way to "unwrap" a selection?
>  
> Say I have selected:
>  
> <note><simpara>the <emphasis>little</emphasis> girl.</simpara></note>
>  
> And I want to change this selection into:
>  
> <simpara>the <emphasis>little</emphasis> girl.</simpara>
>  
> How can this be done?

Sure, you've almost found how to do it. See below.



> Is this the "best" solution to unwrap a selection?
>  
> selectNode children[implicitElement]
> copy [implicitElement]
> selectNode parent[implicitElement]
> paste after[implicitElement]
> selectNode preceding
> cut [implicitElement]

No, it is:

selectNode children
copy
selectNode parent
paste to

* The container to be unwrapped must be selected explicitly.

However you may add a smart way to select the container to be unwrapped
before the "selectNode children". Something like "selectNode
ancestorOrSelf[implicitElement] note tip caution warning important". See
http://www.xmlmind.com/xmleditor/_distrib/doc/commands/selectNode.html

* Using "paste to" is the only 100% safe and reliable way to do it.

As always, please perform each step in sequence interactively (just to
make sure that the sequence is okay) before coding the macro. In the
case of the above sequence, you can even record the macro
(Tools|Macro|Record) rather than code it!

Note that commands which are not bound to a keystroke may be executed
interactively using Esc X (Tools|Execute Command).


Reply via email to