Page 1 of 1

Rename elements in a table column at once

Posted: Thu Jan 11, 2024 10:53 pm
by max3036
Question: Is there a way to rename a recurring element in a table's column all at once without affecting the other columns that have that same element?
I am trying to rename all the <p> elements in my table's first column without changing the <p> elements in all the other columns.
So far I've tried refactoring and using grid mode, but nothing seems to work.
I know I can change each <p> element one at a time, but I need to update several tables, and a single click solution would be great to know, if there is one.

Re: Rename elements in a table column at once

Posted: Sat Jan 13, 2024 2:29 am
by max3036
I figured it out.
In Text mode, right click the element you would like to rename and select Copy XPath.
In Author mode, navigate to the Refactoring menu (this can be done in multiple ways).
In the Refactoring menu, select Rename element. A new menu displays.
In the text box titled Target elements (XPath), paste the copied XPath.
Edit the pasted XPath by removing the bracketed number next to row.
Example:
Paste: /reference/refbody[1]/section[1]/p[1]/table[1]/tgroup[1]/tbody[1]/row[2]/entry[1]/p[1]
Paste with edit: /reference/refbody[1]/section[1]/p[1]/table[1]/tgroup[1]/tbody[1]/row/entry[1]/p[1]
In the text box titled New local name, enter the new element you would like the current element to be renamed to.
Select Finish.

In addition to this, if you would like to insert an element into an column entries that have text but no other element, you can select Wrap element content in the Refactoring menu.

Re: Rename elements in a table column at once

Posted: Mon Jan 15, 2024 8:44 am
by Radu
Hi,
Thanks for sharing the solution, indeed XML Refactoring looks like the proper solution for this one.
Regards,
Radu