> What would be the best method to export these texts in TEI XML? I ruled out
> XSLT since the input text is not a well formed document, perhaps some PERL
> script, or in a similar language? I wonder if there are already available
> solutions, of course I'm prepared to write an extensive "conversion table"
One of the neatest writeups about a text to TEI conversion project
that I've seen is Wendell Piez's "Gustav Fechner's Büchlein vom Leben
nach dem Tode in English Translation: An electronic edition: A TEI
Demonstration", at http://piez.org/wendell/projects/buechlein/. He
assembled a series of XSLT 2.0 stylesheets into an XProc pipeline to
convert a text from archive.org and turned it into TEI (and beyond).
Surely there are some gems in those stylesheets that you might learn
To toss yet another method into the hat, you might consider XQuery for
converting text to TEI. I wrote up a post illustrating the approach:
The challenge in that post was converting plain text lists to TEI
lists, somewhat different than yours, but the general technique would
work just fine.