Page 1 of 1

Refactor: change the value of an @xml:id attribute

Posted: Thu Aug 10, 2023 1:54 pm
by fsteimke
Hi,

id like to suggest the change of an @xml:id Attribute as a new refactoring action.

Changing the value of an @xml:id attribute requires the change of all references to this attribute. Thats the motivation for this feature request. It would be especially helpfull in Projekts with a master Document to set the scope for changes.

Sincerely, Frank Steimke

Re: Refactor: change the value of an @xml:id attribute

Posted: Thu Aug 10, 2023 7:07 pm
by adrian_sorop
Hi,
Currently, I can think of two built-in XML Refactoring operations that are able to change the value of xml:id attribute.
The operations are generic, but you can configure them for specific tasks.
The operations are:
1) Add/Change attribute - https://www.oxygenxml.com/doc/versions/ ... yz_bgk_54b
2) Replace in attribute value - https://www.oxygenxml.com/doc/versions/ ... 11_cgk_54b

Let me know if you encounter any problems while running them.
Adrian S.

Re: Refactor: change the value of an @xml:id attribute

Posted: Fri Aug 11, 2023 3:54 pm
by chrispitude
There are perhaps some tricky aspects to keep in mind:
  • @id values do not need to be unique across files.
  • @id values do not need to be unique across topics, even when they are in the same file.
  • @id values can be used as a part of @keyref references.
Care must be taken to change only the references that are precisely to the element whose @id value is being changed.