Skip to main content
1-Visitor
December 4, 2013
Question

Globally removing a markup tag/element from the whole document

  • December 4, 2013
  • 1 reply
  • 1808 views

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

    1 reply

    18-Opal
    December 4, 2013

    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

    1-Visitor
    March 12, 2014

    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