This is a somewhat delayed reply and I would like to apologise for that.
Thank you all for your very helpful suggestions. I have solved the problem - and in more than one way.
Using WKWebView, as per the suggestion above, I was able to run SaxonCE and pass out the results via a callback handler.
I also managed to work out the correct URL construction to use a 'requests' POST to the oxgarage site.
Finally, I used the WKWebView python to generate book covers automatically and take JPEG screenshots of them to be used in the EPUB books. Please see the linked images of an example EPUB book I produced using pythonista.
Once again, thank you for your assistance.
@sociallydistant thank you!
My fallback option is to parse the tei xml in Python and transform it that way.
I tried using transformToFragment, but it returned null. I think the problem is (possibly) that it doesn't support XSLT 2.0. Perhaps XSLT 1.0 files would suffice to perform the transform. I haven't yet been able to Google up such files, but I'll try again later.
I also noticed that Pythonista has a web server library, but I wasn’t able to get to get a server response when running the included test() function (and I’m not sure it can run concurrently with the other stuff I want to do given the iOS limitations on fork/background processing etc.).
I would like to convert some documents from the Perseus Library into EPUB format. The documents have been made available in TEI XML format, e.g.:
As I understand it, the conversion can be achieved by applying an XSL Transformation. There is a site set up for this, which is fine for a small number of documents, but not especially efficient for more than that:
So I had wondered if I could do something with Pythonista. However, it seems that every approach I consider is thwarted in some way. For example, the libxml library has XSLT functions, but the library is not included with Pythonista and is not pure python.
I wonder if someone could suggest something that would work.