Delete selected multiple elements

Post here questions and problems related to editing and publishing DITA content.
Edomonndo
Posts: 7
Joined: Sat Sep 28, 2019 1:38 pm

Delete selected multiple elements

Post by Edomonndo »

Hi,

We changed to display the definition list as table style.
And our writer requested to add the action to delete dlentry elements because the table style does not show dlentry elements corresponding to row.

I tried DeleteElementsOperation like this:
Xpath activation: ancestor-or-self::*[contains(@class," topic/dlentry ")]
elementLocations: ancestor-or-self::*[contains(@class," topic/dlentry ")]

However, this works if single dlentry is selected. If you select multiple dlentry or inside elements, the last dlentry is deleted.
How can I implement to delete multiple dlentry at once?
Radu
Posts: 8992
Joined: Fri Jul 09, 2004 5:18 pm

Re: Delete selected multiple elements

Post by Radu »

Hi Edmonndo,
No matter how many nodes are selected in the Author mode, there is only one context node for the xpath expression execution.
Maybe you can try something like this for the "ElementLocations" parameter value:

Code: Select all

parent::*/*[contains(@class," topic/dlentry ")]
so that you first go one level up to the parent of the current dlentry and then select all the child dlentry elements of the parent.

Regards,
Radu
Radu Coravu
<oXygen/> XML Editor
http://www.oxygenxml.com
Edomonndo
Posts: 7
Joined: Sat Sep 28, 2019 1:38 pm

Re: Delete selected multiple elements

Post by Edomonndo »

Hi Radu,

Thank you for the advice!
I'll try your code.
Post Reply