How to toggle attribute values?

Having trouble installing Oxygen? Got a bug to report? Post it all here.
Frank Ralf
Posts: 460
Joined: Thu Jan 23, 2014 2:29 pm
Location: Hamburg
Contact:

How to toggle attribute values?

Post 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
Frank Ralf
parson AG
www.parson-europe.com
alex_jitianu
Posts: 1009
Joined: Wed Nov 16, 2005 11:11 am

Re: How to toggle attribute values?

Post 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
Frank Ralf
Posts: 460
Joined: Thu Jan 23, 2014 2:29 pm
Location: Hamburg
Contact:

Re: How to toggle attribute values?

Post 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
Frank Ralf
parson AG
www.parson-europe.com
Post Reply