cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
Showing results for 
Search instead for 
Did you mean: 

Community Tip - Learn all about PTC Community Badges. Engage with PTC and see how many you can earn! X

Globally removing a markup tag/element from the whole document

ptc-5389550
1-Newbie

Globally removing a markup tag/element from the whole document

Sorry for the very basic question. I am trying to figure out how to globally remove a markup xml tag/element from our documents. The find and replace feature doesn't seem to be able to do it. It can only find and replace text. And the comand line and edit features will only allow me to delete markup one at a time.

I cannot even seem to figure out a way to search for specific tags.

Can anyone help me? Thank you!

Dina

2 REPLIES 2

Hi Dina--

To do this for all instances in the document, you will probably need to write some ACL script code. Here is some code you can use as an example:

oid_find_children(oid_root(),$oids,"indexterm");

for ($o in $oids) {

oid_delete($oids[$o]);

}

This will eliminate all the instances of the element <indexterm>. Just replace that name in the first line with the name of the element you want to remove.

Put this code into file with the extension *.acl, for example "delete_indexterms.acl". You can put it in your scripts folder in the custom folder, and then run the code on a document by loading the document and typing "source delete_indexterms.acl" on the Arbortext command line.

--Clay

Clay,

This was exactly what I was looking for, as I faced the same challenge as Dina, and needed a way of storing these elements in an array that I could work with.

The reason for using arrays is of course that when using the regular "for (oid_first; oid_valid; oid_forward)" to find the elements, and then "oid_delete" them as you go, will invalidate the oid tree as soon as the first element is deleted.

Cheers!

--Rune

Top Tags