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

Community Tip - You can change your system assigned username to something more personal in your community settings. X

ACL Help oid_find_chidren

SarahPrice
7-Bedrock

ACL Help oid_find_chidren

I'm trying to write an ACL script that will remove <revst>, <revend> and chg attributes within a specific tag. My problem is that it is deleting the tags and attribute from the entire document not just the specified tag.

Here is the portion of the ACL that is not working:

#Deletes all Rev bars and change attributes from the Front.
case 'Front':
{
response("You have selected the Front.")
}
for (m = oid_first(mfmatr); oid_valid(m); m = oid_forward(m))
{
oid_find_children(m, revst_oids, 'revst');
for (a=1; a<=count(revst_oids); a++)
{oid_delete(revst_oids[a], 0x1)}

oid_find_children(m, revend_oids, 'revend');
for (b=1; b<=count(revend_oids); b++)
{oid_delete(revend_oids[b], 0x1)}

oid_find_child_attrs(m,h,'chg','r|n',8);
for (i = 1; i<= count(h); i++)
{oid_delete_attr(h[i], 'chg');}
}
break;

Any help would be greatly appreciated as I am a rookie at best in ACL.

Sarah

2 REPLIES 2

Hi, Sarah...

Your "for" loop is walking through the entire document. The
oid_find_children function will find children at any level underneath
the OID you specify for the first argument (it might be better called
oid_find_descendants, really).

So, you really just need to call oid_find_children once, passing it
the OID of the element whose <revst> elements you want to find.

-Brandon 🙂

Thanks Brandon. As always you are a great help! I got it to work.

Sarah
Top Tags