Skip to main content

The PreTeXt Guide

Section 28.1 String Parameters

The majority of the conversions that PreTeXt supports are accomplished via an Extensible Stylesheet Language (XSL) stylesheet. This language has a parameter feature which allows an external value (as a small chunk of text) to be provided to the stylesheet externally. In this way, a single stylesheet can produce small changes in output in reaction to a parameter value, without the need for creating multiple stylesheets. We say that the stylesheet is parameterized by the parameter. These are often called stringparam since that is the command-line switch used by the xsltproc executable for the external communication (Chapter 46).
The conversion to source, as a precursor of PDF output is a good example. A string parameter specifies the size of the font, which causes small changes to the source file in the appropriate ways. Similarly, a PDF should be different if it is meant to be become a hardcopy printed book, or if it is meant to be viewed on an electronic screen. This dichotomy is reflected by a simple string parameter (with values yes or no) and then a single stylesheet can produce two outputs that are different in substantial ways. Note that a publisher is insulated from any of this discussion for these two examples as the publisher file (Section 26.1) handles all the logistics. See the publisher file options at Subsection 44.3.4 and Subsection 44.3.1.
Some string parameters are just for internal use, especially when multiple stylesheets are chained together to accomplish a complicated conversion, such as to EPUB (Chapter 31) or braille. Others are used to allow developers to optionally test-drive some new features—these usually have debug in their name. We once used string parameters directly to accomplish publisher customizations. As of 2022-10-24 we are well along to moving these to the publication file, though we mention this here since this transition is not 100% complete.
The method for supplying an (external) string parameter to the processing of a PreTeXt project varies depending on the tool used for processing.