Huditsch, Roman (LNG-VIE) wrote:
> 
> I now came up with another problem, I couldn't solve.
> I need to copy the current text selection (going over different
> elements)
> to the clipboard (just the text).
> No problem so far. I could do this with
> <cfg:command name="copyChars" parameter="%_"/>
> But how do I manage to replace all "." in this selection with ". "?
> I tried different ways with get and set, but with no success.
> 
> Do you have any hint on how to solve this?

<binding>
   <keyPressed code="F3" />
   <command name="Test" />
</binding>

<command name="Test">
   <macro>
     <sequence>
       <test expression="string-length($selectedChars) &gt; 0 and
                         contains($selectedChars, '.')" />
       <get expression="replace($selectedChars, '\.', '. ')" />
       <command name="paste" parameter="to %_" />
     </sequence>
   </macro>
</command>

* $selectedChars documented in
http://www.xmlmind.com/xmleditor/_distrib/doc/commands/selection_vars.html

* replace() documented in
http://www.xmlmind.com/xmleditor/_distrib/doc/commands/xpathextfunc.html

(string-length() and contains() are standard XPath 1 functions.)

* paste documented in
http://www.xmlmind.com/xmleditor/_distrib/doc/commands/paste.html

Reply via email to