Chapter 46 Processing with
The executable program
xsltprocimplements Version 1.0 of the eXtensible Stylesheet Language (XSL) . This is a declarative language that walks the hierarchical tree of an XML source file, and for each element describes some output to produce before, and after, recursively processing the contained elements. (That is a simplified description.)
xsltprocis typically installed by default on Linux systems and as part of Mac OS. See the PreTeXt website for details for Windows systems. The most basic operation is to provide
xsltprocwith an XSL stylesheet from the PreTeXt distribution and an XML document of your creation that is valid PreTeXt. This is done at the command-line, inside of a terminal or shell. Describing command-line operations, along with file and directory management, is beyond the scope of this guide, so consult another resource if this is unfamiliar. So here is a hypothetical simple example:
rob@lava:~/mathbook$ xsltproc xsl/pretext-html.xsl ~/books/aota/animals.xml
xsltprocwrites output to
stdout(the screen), which you could redirect to a file, or you could use the
-oswitch to send the output to a named file. However, PreTeXt automatically writes to a file whose name is derived from the
@xml:idattribute of the top-level
<article>tag. If no such attribute is given the filename will be derived from
article-1. All output is produced in whatever the current default directory is, so you will likely want to set this beforehand.
xslsubdirectory of the PreTeXt distribution contains a variety of XSL stylesheets, which I will also refer to as converters or conversions . The ones that you will use as an author all have filenames of the form
XXXis some indication of the output produced. Conversions to LaTeXor HTML output are the two most mature converters.
Note that authors are not responsible for creating XSL stylesheets. Stock conversions are part of the PreTeXt distribution, and anybody is welcome to assume a source document is valid PreTeXt and create new conversions to process it to existing, or as yet unimagined, formats.