Page 1 of 1

How to toggle attribute values?

Posted: Tue Mar 18, 2014 6:45 pm
by Frank Ralf
I want to create an Author Action for toggling the alignment of selected table cells.

Among the Author Default Operations there is a ChangeAttributeOperation and a ToggleSurroundWithElementOperation.

Is there a way to combine these to create something like a "ToggleAttributeOperation"?

TIA
Frank

Re: How to toggle attribute values?

Posted: Wed Mar 19, 2014 3:15 pm
by alex_jitianu
Hello,

ChangeAttributeOperation should be enough. Just create an author action with two action modes, one for each possible state of the attribute:
1. First operation mode. Activation XPath: @currency (the attribute exists) and ChangeAttributeOperation will set @currency to an empty value to remove it.
2. Second operation mode. No activation XPath because it's the default and so it will be activated only when the attribute is not present. ChangeAttributeOperation will set @currency to its value.

The operation modes are configurable in the Action Dialog.

Best regards,
Alex

Re: How to toggle attribute values?

Posted: Wed Mar 19, 2014 3:34 pm
by Frank Ralf
Thanks for these pointers. I had a look at some similar actions but couldn't figure out what to change.

Cheers,
Frank