XSLT is a declarative domain-specific language for transforming and manipulating trees and forests. Its more powerful than you might expect, and these days can read and write EPUB files.
Using fn:transform(), file:write(), archive:zip() and more.
This course is in preparation; the first run will be in March 2019, in Toronto; see the [offsite] ebookcraft blog entry about it.
Contact liam at fromoldbooks.org for more information.