Hi,
Unfortunately, that is not quite what I needed.
I just want to copy the replaced text to the clipboard. The pasting is done in
an extra step.
My problem is that the copyChar command is ignoring the replacement done by the
"get" expression.
If I change
<command name="Test">
<macro>
<sequence>
<test expression="string-length($selectedChars) > 0 and
contains($selectedChars, '.')" />
<get expression="replace($selectedChars, '\.', '. ')" />
<command name="paste" parameter="to %_" />
</sequence>
</macro>
</command>
To
<command name="Test">
<macro>
<sequence>
<test expression="string-length($selectedChars) > 0 and
contains($selectedChars, '.')" />
<get expression="replace($selectedChars, '\.', '. ')" />
<command name="copyChars" parameter="%_" />
</sequence>
</macro>
</command>
I just get the selected characters without the additional whitespace in my
clipboard.
Best regards,
Roman
-----Urspr?ngliche Nachricht-----
Von: Hussein Shafie [mailto:hussein at xmlmind.com]
Gesendet: Mittwoch, 19. M?rz 2008 10:21
An: Huditsch, Roman (LNG-VIE)
Cc: xmleditor-support at xmlmind.com
Betreff: Re: [XXE] copyChar in conjunction with replace
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) > 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