Sorry for the confusion, Nige.
The strange xml file is the file format that Transit creates from all file formats that it can import. They separate the text content from binary content (images etc.) and store it in the intermediate xml format. (Once the translation is finished, they merge the xml with the binary content to recreate the original files.)
Inside Transit, these InDesign, FrameMaker, Ms Word etc. files are displayed kind of wysiwyg, via this xml:
The thing is that I often don't receive the imported files or that I cannot open them because I don't have the app that created the imported files.
Another thing is dat I don't want to translate these xml files (generated by Transit) in Transit itself but in a Java app (CafeTran) on macOS. The handling of the xml is already perfect in CafeTran, but there is often no preview file (unless the client sends a pdf that I can open in Skim).
So what I am trying to do here is:
- Unpack the translation package that the client sends to me.
- Open the target language xml in CafeTran to translate it.
- Convert the source language xml to html to preview it via the html viewer in CafeTran (which is synced per paragraph/segment).
I ran a series of replacement actions in BBEdit just to test the concept:
Etc. etc.
It seems to work for this simple file in html format that I have imported in Transit as a first test. It is very likely that more complex file formats, like docx, create more complex xml files in Transit format. That would be the next test.
EDIT: I have created an Ms Word document with the same structure and content and imported that in Transit too. The Transit xml file for this docx is here:
Test Ms Word.ENG.xml.zip (3.4 KB)
A lot of extra font info, but the structure looks similar to the xml created from the html.
To respond to Rob's remark about Keyboard Maestro only being slightly relevant here: that is correct. However, I can try to do the replacements in Keyboard Maestro too, at a later stage.
I'll attach to this post the BBEdit'ed version of the html I created. I added a header manually and didn't care (at this moment) for the image and link.
Test.xml.html.zip (1.0 KB)
I have decided to create a BBEdit textfactory:
Create Transit preview file.textfactory.zip (1.5 KB)
This is tested with xml files created by importing docx files in Transit. It is a first draft.
Nige and Rob: thank you for your input!