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

COUNTING ELEMENTS

Level 1

COUNTING ELEMENTS

I am looking for a way to count the different tags used in my document.

I am using a slightly modified Navy NAVSEAC2 DTD and am looking to edit the DTD
to remove all the unused tags.

Since I have over 80 documents I want to make sure that I haven't left any out.

Thanks,
Bill Kone
Tags (2)
2 REPLIES 2
Highlighted

COUNTING ELEMENTS

I got this function from the Arbortext ACL course last year. I just ran it
to make sure I hadn't "corrupted" it in any of my playing around. From the
command line run "count_tags()" (without the quotes). You'll need to read
past the PI's, but you'll get a list of everything in the instance.

#---------------------------------------------
# count_tags
#
# Description :
#
# Count all the occurrences of each tag in the current document
#
# Usage syntax : count_tags()
#
# Inputs : none
#
# Returns : List of all tags in the document and how many times
# they occur
#
#---------------------------------------------
function count_tags () {

delete(COUNTS);
caret first,first;
o = oid_first();

while (oid_valid(o)) {
n = oid_name(o);
COUNTS[n]++
o = oid_forward(o);
}
eval "Number of occurrences of each tag in this document\n\n";
for (n in COUNTS) {
eval "\t $COUNTS[$n] \t $n" output=>*
}
}

Lynn E. Hales
Information Systems Specialist
AMSEC LLC
(757)688-9324
hales_le@nns.com

COUNTING ELEMENTS

I got this function from the Arbortext ACL course last year. I just ran it
to make sure I hadn't "corrupted" it in any of my playing around. From the
command line run "count_tags()" (without the quotes). You'll need to read
past the PI's, but you'll get a list of everything in the instance.

#---------------------------------------------
# count_tags
#
# Description :
#
# Count all the occurrences of each tag in the current document
#
# Usage syntax : count_tags()
#
# Inputs : none
#
# Returns : List of all tags in the document and how many times
# they occur
#
#---------------------------------------------
function count_tags () {

delete(COUNTS);
caret first,first;
o = oid_first();

while (oid_valid(o)) {
n = oid_name(o);
COUNTS[n]++
o = oid_forward(o);
}
eval "Number of occurrences of each tag in this document\n\n";
for (n in COUNTS) {
eval "\t $COUNTS[$n] \t $n" output=>*
}
}

Lynn E. Hales
Information Systems Specialist
AMSEC LLC
(757)688-9324
hales_le@nns.com