Framework: ChangeAttributeOperation

Post here questions and problems related to oXygen frameworks/document types.
Posts: 36
Joined: Wed Jun 20, 2018 11:30 am

Framework: ChangeAttributeOperation

Post by pieterjan_vdw »

I try to use the ChangeAttributeOperation.
It works to add an attribute to the selected element when the given attribute is empty.
However, when there is already an attribute value in my selected element, it simply overrides the existing attribute value.
I would like to add it as a second attribute value.
This is my current action:
changeattributeoperation.png (27.37 KiB) Viewed 161 times
Simple example
<p nr_jqs="first">this is a paragraph</p>

After clicking the change operation I would like to get:
<p nr_jqs="first 2_jq">this is a paragraph</p>

How can I do this? Thanks a lot in advance.

Kind regards,
Posts: 8092
Joined: Fri Jul 09, 2004 5:18 pm

Re: Framework: ChangeAttributeOperation

Post by Radu »

Hi Pieterjan,

The default ChangeAttributeOperation just sets the new value instead of the old one, there is no setting to instruct it to preserve the old value.
Maybe you can use a JSOperation instead and write a small script which uses our APIs to check what the old value of the element is, take the old value, combine it with the new value and set it back: ... soperation

There are some sample JSOperations here: ... operations

Radu Coravu
<oXygen/> XML Editor
Post Reply