As we discussed in Section 5.9 , there are many advantages to describing images directly in the source of your PreTeXt document. However, these must be processed with various “helper” programs such as asy,pdflatex, and sage.
The issue with this is that XSL is not a general purpose programming language, and so in particular, cannot call the “helper” programs. The general strategy is to use XSL to identify and isolate the parts of a document that lie in the elements designed for graphics languages. A Python script, the pretext script, employs these XSL stylesheets and then feeds each image file to the appropriate helper program.