
Hello Andreas, Executing actions recursively is forbidden at a very low level because it usually signals a problem. I admit though, that once the ExecuteMultipleActionsOperation was introduced, a desired recursive use case can happen (just like you've describe it). We will investigate to see if we will allow the recursive behavior but meanwhile, you can just introduce a new action to compound the other two (the "abbr.dontask" and add "choice abbr+expan"). Something like this: 1. Strip element tags action. This action is not present in the toolbar or menu (it is not intended for the user to use it directly) id "abbr.dontask" Activation XPath: Operation: ro.sync.ecss.extensions.commons.operations.UnwrapTagsOperation 2. You're custom action that adds the "abbr", "expan" and "choice". This action is not present in the toolbar or menu (it is not intended for the user to use it directly) id "choice abbr+expan" Activation XPath: Operation: my.custom.operations.ChoiceAbbrExpan 3. An action that brings the two previous actions together, This is the action that is available in the toolbar for the user to use. id "complex.choice abbr+expan" mode 1: Activation XPath: self::*:abbr Operation: ro.sync.ecss.extensions.commons.operations.ExecuteMultipleActionsOperation (abbr.dontask, choice abbr+expan) mode 2: Activation XPath: Operation: ro.sync.ecss.extensions.commons.operations.ExecuteMultipleActionsOperation (choice abbr+expan) Best regards, Alex -- Alex Jitianu <oXygen/> XML Editor, Schema Editor and XSLT Editor/Debugger http://www.oxygenxml.com On 31-Mar-14 11:44 AM, Andreas Wagner wrote:
Dear all,
I have an author mode action which I want to behave recursively, but this does not seem to work. Can I do something about it?
Here is my action/use case: I want to edit TEI xml documents and add expansions to abbreviations. When I select a text and trigger my action, it surrounds the selected text with an <abbr/> element, adds an <expan/> element the content of which is queried in a dialogue box, and surrounds both of these elements with a <choice/> element. Now, when someone has edited the document before and has marked something as being an abbreviation, but has not noted its expansion, the selected text already is an <abbr/> element. Using a second action mode and the ExecuteMultipleActionsOperation, I want to catch this, strip the <abbr/> and re-add it along with the whole rest of the construct.
I know that this is not how to handle such action definitions best, but rather than explaining what I have inserted in which dialogue field, I post what the action looks like in the framework file (well, somewhat - I have left out some parameters):
<action> <field name="id"> <String>choice abbr+expan</String> </field> ... <field name="actionModes"> <actionMode-array> <actionMode> <field name="xpathCondition"> <String>*:abbr</String> </field> <field name="argValues"> <map> <entry> <String>actionIDs</String> <String>abbr.dontask choice abbr+expan</String> </entry> </map> </field> <field name="operationID"> <String>ro.sync.ecss.extensions.commons.operations.ExecuteMultipleActionsOperation</String> </field> </actionMode> <actionMode> <field name="xpathCondition"> <String></String> </field> <field name="argValues"> <map> <entry> <String>fragment</String> <String><choice xmlns="http://www.tei-c.org/ns/1.0"><abbr></abbr><expan>${ask('Expansion?', generic)}</expan></choice></String> </entry> </map> </field> <field name="operationID"> <String>ro.sync.ecss.extensions.commons.operations.SurroundWithFragmentOperation</String> </field> </actionMode> </actionMode-array> </field> </action>
(The abbr.dontask action toggles (i.e. removes in this case) the surrounding abbr element; and when I use another action in the MultipleActions above (say, choice orig+reg), it works fine. It only fails to call itself, it seems.)
Thank you for any hint. Best,
Andreas