Chapter 43 Processing with
The executable program
xsltproc implements 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.)
xsltproc is 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
xsltproc with 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
xsltproc writes output to
stdout (the screen), which you could redirect to a file, or you could use the
-o switch to send the output to a named file. However, PreTeXt automatically writes to a file whose name is derived from the
@xml:id attribute 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.
xsl subdirectory 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
XXX is 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.