0cf993
1,/
0cf993
0cf993
# on each new iso-code process the current one
0cf993
\!\(<iso_639_entry\|</iso_639_entries>\)!{
0cf993
    x
0cf993
    s/^$//
0cf993
    # we are on the first iso-code--nothing to process here
0cf993
    t
0cf993
    # process and write to output
0cf993
    s/\s\+/ /g
0cf993
    s/
0cf993
    s!/\s*>!!
0cf993
    # use '%' as a separator of parsed and unparsed input
0cf993
    s/\(.*\)iso_639_2T_code="\([^"]\+\)"\(.*\)/\2 % \1 \3/
0cf993
    s/\([^%]\+\)%\(.*\)iso_639_2B_code="\([^"]\+\)"\(.*\)/\1\t\3 % \2 \4/
0cf993
    #  clear subst. memory for the next t
0cf993
    t clear
0cf993
    :clear
0cf993
    s/\([^%]\+\)%\(.*\)iso_639_1_code="\([^"]\+\)"\(.*\)/\1\t\3 % \2 \4/
0cf993
    t name
0cf993
    # no 639-1 code--write xx
0cf993
    s/%/\tXX %/
0cf993
    :name
0cf993
    s/\([^%]\+\)%\(.*\)name="\([^"]\+\)"\(.*\)/\1\t\3/
0cf993
    s/ \t/\t/g
0cf993
    p
0cf993
    b
0cf993
    :noout
0cf993
}
0cf993
0cf993
H