I'm working with XML files (using the NLM journalpublishing 3.0 DTD) in Arbortext 5.3. I'm modifying a set of ACL functions that are used to find author/date in-text cross-references (<xref>) and match them to items in the reference list (<ref>s in the <ref-list>). This is code that we had been using for more than 10 years with SGML files. The functions find a untagged date-like string of numbers and then looks at the text to the left of the date-link string to see if it can match a combination of authors and date to an item in the reference list.
If I include a response() after finding each date-like string, then the functions correctly finds and tags most (130 tagged <xref>s of 180 dates in my test document; only 5 unmatched; the other 45 are not <xref>s). However, if I remove the response() then the functions get stuck with constantly a increasing selection (the longest I saw contained more than 10,000 words) so that no <xref> tags are inserted into the document. It seems as if there is some arbitary point being marked and saved that is causing the selection to keep growing and I can't figure out where, why, or how that marked point is being set.
I have attached a file which includes the set of functions that I am working on. I inherited this project from another programmer who no longer works here and who had a great deal more experience with ACL than I do.
Any advice would be greatly appreciated.